1
0
forked from baron/baron-sso

감사로그 수행자 표시

This commit is contained in:
2026-05-15 11:13:25 +09:00
parent 0bf8089120
commit 94f33a0a64
4 changed files with 169 additions and 3 deletions

View File

@@ -268,14 +268,25 @@ func isDevConsoleViewerRole(role string) bool {
}
}
func setCurrentProfileContext(c *fiber.Ctx, profile *domain.UserProfileResponse) {
if profile == nil {
return
}
c.Locals("user_profile", profile)
if existingUserID, _ := c.Locals("user_id").(string); existingUserID == "" && profile.ID != "" {
c.Locals("user_id", profile.ID)
}
}
func (h *DevHandler) getCurrentProfile(c *fiber.Ctx) *domain.UserProfileResponse {
if profile, ok := c.Locals("user_profile").(*domain.UserProfileResponse); ok && profile != nil {
setCurrentProfileContext(c, profile)
return profile
}
if h.Auth != nil {
enriched, err := h.Auth.GetEnrichedProfile(c)
if err == nil && enriched != nil {
c.Locals("user_profile", enriched)
setCurrentProfileContext(c, enriched)
return enriched
}
}
@@ -909,10 +920,11 @@ func (h *DevHandler) checkAppManagerPermission(c *fiber.Ctx) (bool, error) {
if err == nil && enriched != nil {
profile = enriched
ok = true
c.Locals("user_profile", enriched)
setCurrentProfileContext(c, enriched)
}
}
if ok && profile != nil {
setCurrentProfileContext(c, profile)
role := normalizeUserRole(profile.Role)
switch role {
case domain.RoleSuperAdmin:
@@ -3583,7 +3595,7 @@ func (h *DevHandler) RequestDeveloperAccess(c *fiber.Ctx) error {
if h.Auth != nil {
if enriched, err := h.Auth.GetEnrichedProfile(c); err == nil && enriched != nil {
profile = enriched
c.Locals("user_profile", enriched)
setCurrentProfileContext(c, enriched)
}
}