This commit is contained in:
2026-08-21 00:09:32 +07:00
parent 7656100fe6
commit a2cadf6eca
20 changed files with 320 additions and 94 deletions
+2 -18
View File
@@ -1,23 +1,7 @@
package roles
const (
Admin = "admin"
Author = "author"
Organizer = "organizer"
User = "user"
)
var AllRoles = []string{
Admin,
Author,
Organizer,
User,
}
type IHasRole interface {
HasRole(role string) bool
}
// HasRole возвращает true, если у субъекта есть роль; администратор
// проходит проверку любой роли.
func HasRole(claims IHasRole, role string) bool {
if claims.HasRole(Admin) {
return true