[management] restrict dashboard only to restrictable roles

This commit is contained in:
Pedro Costa
2025-04-16 19:34:20 +01:00
parent 974f297022
commit ab391ed9fa
8 changed files with 156 additions and 22 deletions

View File

@@ -121,6 +121,11 @@ func (u *User) IsRegularUser() bool {
return !u.HasAdminPower() && !u.IsServiceUser
}
// IsRestrictable checks whether a user is in a restrictable role.
func (u *User) IsRestrictable() bool {
return u.Role == UserRoleUser || u.Role == UserRoleBillingAdmin
}
// ToUserInfo converts a User object to a UserInfo object.
func (u *User) ToUserInfo(userData *idp.UserData) (*UserInfo, error) {
autoGroups := u.AutoGroups