feat: complete pet SOP governance workflow
This commit is contained in:
19
internal/auth/permissions.go
Normal file
19
internal/auth/permissions.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package auth
|
||||
|
||||
func HasPermission(principal Principal, permission string) bool {
|
||||
for _, allowed := range principal.Permissions {
|
||||
if allowed == "*" || allowed == permission {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func HasAnyPermission(principal Principal, permissions ...string) bool {
|
||||
for _, permission := range permissions {
|
||||
if HasPermission(principal, permission) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user