[v11.3.x] Folders: Add admin permissions upon creation of a folder w. SA (#95365)
Folders: Add admin permissions upon creation of a folder w. SA (#95072) * add admin permissions upon creation of a folder w. SA * Update pkg/services/folder/folderimpl/folder.go Co-authored-by: Karl Persson <kalle.persson@grafana.com> * Grant service account permissions for creation of dashboards * Grant service account admin permissions upon creating a datasource * fetch user using the userservice with the userid * Revert "fetch user using the userservice with the userid" This reverts commit23cba78752. * revert back to original datasource creation --------- Co-authored-by: Karl Persson <kalle.persson@grafana.com> (cherry picked from commit9ab064bfc5) Co-authored-by: Eric Leijonmarck <eric.leijonmarck@gmail.com>
This commit is contained in:
co-authored by
Eric Leijonmarck
parent
86deb2b4c4
commit
5889d680e9
@@ -78,7 +78,7 @@ func (r ReceiverPermissionsService) SetDefaultPermissions(ctx context.Context, o
|
||||
r.log.Debug("Setting default permissions for receiver", "receiver_uid", uid)
|
||||
permissions := defaultPermissions()
|
||||
clearCache := false
|
||||
if user != nil && user.IsIdentityType(claims.TypeUser) {
|
||||
if user != nil && user.IsIdentityType(claims.TypeUser, claims.TypeServiceAccount) {
|
||||
userID, err := user.GetInternalID()
|
||||
if err != nil {
|
||||
r.log.Error("Could not make user admin", "receiver_uid", uid, "id", user.GetID(), "error", err)
|
||||
|
||||
@@ -523,7 +523,7 @@ func (dr *DashboardServiceImpl) setDefaultPermissions(ctx context.Context, dto *
|
||||
inFolder := dash.FolderID > 0
|
||||
var permissions []accesscontrol.SetResourcePermissionCommand
|
||||
|
||||
if !provisioned && dto.User.IsIdentityType(claims.TypeUser) {
|
||||
if !provisioned && dto.User.IsIdentityType(claims.TypeUser, claims.TypeServiceAccount) {
|
||||
userID, err := dto.User.GetInternalID()
|
||||
if err != nil {
|
||||
dr.log.Error("Could not make user admin", "dashboard", dash.Title, "id", dto.User.GetID(), "error", err)
|
||||
|
||||
@@ -681,7 +681,7 @@ func (s *Service) setDefaultFolderPermissions(ctx context.Context, orgID int64,
|
||||
|
||||
var permissions []accesscontrol.SetResourcePermissionCommand
|
||||
|
||||
if user.IsIdentityType(claims.TypeUser) {
|
||||
if user.IsIdentityType(claims.TypeUser, claims.TypeServiceAccount) {
|
||||
userID, err := user.GetInternalID()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user