mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
RBAC: Fix authorize in org (#81552)
* RBAC: Fix authorize in org * Implement option 2 * Fix typo * Fix alerting test * Add test to cover the not member case
This commit is contained in:
@@ -31,6 +31,7 @@ const (
|
||||
|
||||
const (
|
||||
AnonymousNamespaceID = NamespaceAnonymous + ":0"
|
||||
GlobalOrgID = int64(0)
|
||||
)
|
||||
|
||||
var _ identity.Requester = (*Identity)(nil)
|
||||
@@ -164,6 +165,19 @@ func (i *Identity) GetPermissions() map[string][]string {
|
||||
return i.Permissions[i.GetOrgID()]
|
||||
}
|
||||
|
||||
// GetGlobalPermissions returns the permissions of the active entity that are available across all organizations
|
||||
func (i *Identity) GetGlobalPermissions() map[string][]string {
|
||||
if i.Permissions == nil {
|
||||
return make(map[string][]string)
|
||||
}
|
||||
|
||||
if i.Permissions[GlobalOrgID] == nil {
|
||||
return make(map[string][]string)
|
||||
}
|
||||
|
||||
return i.Permissions[GlobalOrgID]
|
||||
}
|
||||
|
||||
func (i *Identity) GetTeams() []int64 {
|
||||
return i.Teams
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user