mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-22 18:25:47 +08:00
feat: fix bug in GetAllowedApplications()
This commit is contained in:
parent
498cd02d49
commit
a9e72ac3cb
@ -346,7 +346,7 @@ func GetMaskedApplications(applications []*Application, userId string) []*Applic
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetAllowedApplications(applications []*Application, userId string) ([]*Application, error) {
|
func GetAllowedApplications(applications []*Application, userId string) ([]*Application, error) {
|
||||||
if isUserIdGlobalAdmin(userId) {
|
if userId == "" || isUserIdGlobalAdmin(userId) {
|
||||||
return applications, nil
|
return applications, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,8 +354,7 @@ func GetAllowedApplications(applications []*Application, userId string) ([]*Appl
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if user != nil && user.IsAdmin {
|
||||||
if user.IsAdmin {
|
|
||||||
return applications, nil
|
return applications, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +851,7 @@ func (user *User) GetId() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isUserIdGlobalAdmin(userId string) bool {
|
func isUserIdGlobalAdmin(userId string) bool {
|
||||||
return strings.HasPrefix(userId, "built-in/")
|
return strings.HasPrefix(userId, "built-in/") || strings.HasPrefix(userId, "app/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExtendUserWithRolesAndPermissions(user *User) (err error) {
|
func ExtendUserWithRolesAndPermissions(user *User) (err error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user