refactoring: Dashboard guardian

This commit is contained in:
Torkel Ödegaard
2017-06-16 21:25:24 -04:00
parent d9dca72ee4
commit 3fe031d25d
6 changed files with 119 additions and 19 deletions
+2 -2
View File
@@ -54,8 +54,8 @@ type DashboardAclInfoDTO struct {
UserEmail string `json:"userEmail"`
UserGroupId int64 `json:"userGroupId"`
UserGroup string `json:"userGroup"`
PermissionType PermissionType `json:"permissionType"`
Permissions string `json:"permissions"`
Permissions PermissionType `json:"permissions"`
PermissionName string `json:"permissionName"`
}
//
+8
View File
@@ -162,6 +162,14 @@ type SignedInUser struct {
HelpFlags1 HelpFlags1
}
func (user *SignedInUser) HasRole(role RoleType) bool {
if user.IsGrafanaAdmin {
return true
}
return user.OrgRole.Includes(role)
}
type UserProfileDTO struct {
Email string `json:"email"`
Name string `json:"name"`