This commit is contained in:
2026-02-11 17:46:22 +03:00
commit eacfacb13b
266 changed files with 51337 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package permissions
// 🔥 SYSTEM / ADMIN ROLE IDS
var AdminRoleIDs = map[int]struct{}{
1: {},
3: {},
}
// -------------------------------------------------------
// 🧠 ROLE POLICY
// -------------------------------------------------------
func ResolveEffectiveRoles(
roleIDs []int,
) (effectiveRoleIDs []int, isAdmin bool) {
roleMap := make(map[int]struct{})
for _, roleID := range roleIDs {
// 🔥 SYSTEM / ADMIN OVERRIDE (1,3,…)
if _, ok := AdminRoleIDs[roleID]; ok {
return []int{roleID}, true
}
roleMap[roleID] = struct{}{}
}
for id := range roleMap {
effectiveRoleIDs = append(effectiveRoleIDs, id)
}
return effectiveRoleIDs, false
}