feat: more role backend and admin/writer roles additions and adjustments
This commit is contained in:
1 parent
8c6c6456da
commit
de142f6c5f
131 files changed
+2663
-435
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"RenewCMS/internal/domain/audit"
|
||||
"RenewCMS/internal/domain/author"
|
||||
"RenewCMS/internal/domain/image"
|
||||
"RenewCMS/internal/domain/role"
|
||||
"RenewCMS/internal/domain/user"
|
||||
"errors"
|
||||
"strconv"
|
||||
@@ -14,15 +15,11 @@ const authorChangeSeparator = ", "
|
||||
|
||||
type AuthorCaller struct {
|
||||
UserID uint32
|
||||
Role user.Role
|
||||
Grants role.GrantSet
|
||||
}
|
||||
|
||||
func isAdminRole(role user.Role) bool {
|
||||
return role == user.RoleOwner || role == user.RoleAdmin
|
||||
}
|
||||
|
||||
func (c AuthorCaller) isAdmin() bool {
|
||||
return isAdminRole(c.Role)
|
||||
func (c AuthorCaller) seesUserEmail() bool {
|
||||
return c.Grants.Holds(role.KeyUsersView)
|
||||
}
|
||||
|
||||
func authorTarget(a author.Author) audit.Target {
|
||||
|
||||
Reference in new issue
Block a user