refactoring dashoard folder guardian
This commit is contained in:
@@ -63,11 +63,11 @@ type DashboardAclInfoDTO struct {
|
||||
//
|
||||
|
||||
type AddOrUpdateDashboardPermissionCommand struct {
|
||||
DashboardId int64 `json:"-"`
|
||||
OrgId int64 `json:"-"`
|
||||
UserId int64 `json:"userId"`
|
||||
UserGroupId int64 `json:"userGroupId"`
|
||||
PermissionType PermissionType `json:"permissionType" binding:"Required"`
|
||||
DashboardId int64 `json:"-"`
|
||||
OrgId int64 `json:"-"`
|
||||
UserId int64 `json:"userId"`
|
||||
UserGroupId int64 `json:"userGroupId"`
|
||||
Permissions PermissionType `json:"permissionType" binding:"Required"`
|
||||
|
||||
Result DashboardAcl `json:"-"`
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ type SaveDashboardCommand struct {
|
||||
}
|
||||
|
||||
type DeleteDashboardCommand struct {
|
||||
Slug string
|
||||
Id int64
|
||||
OrgId int64
|
||||
}
|
||||
|
||||
|
||||
+12
-3
@@ -32,11 +32,20 @@ func (r RoleType) Includes(other RoleType) bool {
|
||||
if r == ROLE_ADMIN {
|
||||
return true
|
||||
}
|
||||
if r == ROLE_EDITOR || r == ROLE_READ_ONLY_EDITOR {
|
||||
return other != ROLE_ADMIN
|
||||
|
||||
if other == ROLE_READ_ONLY_EDITOR {
|
||||
return r == ROLE_EDITOR || r == ROLE_READ_ONLY_EDITOR
|
||||
}
|
||||
|
||||
return r == other
|
||||
if other == ROLE_EDITOR {
|
||||
return r == ROLE_EDITOR
|
||||
}
|
||||
|
||||
if other == ROLE_VIEWER {
|
||||
return r == ROLE_READ_ONLY_EDITOR || r == ROLE_EDITOR || r == ROLE_VIEWER
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (r *RoleType) UnmarshalJSON(data []byte) error {
|
||||
|
||||
Reference in New Issue
Block a user