From cdddd16c0af3396a1debc34e5c40dffe6755af3f Mon Sep 17 00:00:00 2001 From: jkoberg Date: Mon, 27 Feb 2023 11:27:47 +0100 Subject: [PATCH] add permission to change space quota Signed-off-by: jkoberg --- .../set-project-space-quota-permission.md | 5 +++ .../settings/pkg/store/defaults/defaults.go | 44 ++++++++++++++----- sonar-project.properties | 2 +- 3 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 changelog/unreleased/set-project-space-quota-permission.md diff --git a/changelog/unreleased/set-project-space-quota-permission.md b/changelog/unreleased/set-project-space-quota-permission.md new file mode 100644 index 0000000000..2b62a04df5 --- /dev/null +++ b/changelog/unreleased/set-project-space-quota-permission.md @@ -0,0 +1,5 @@ +Enhancement: Add new SetProjectSpaceQuota permission + +Additionally to `set-space-quota` for setting quota on personal spaces we now have `Drive.ReadWriteQuota.Project` for setting project spaces quota + +https://github.com/owncloud/ocis/pull/5660 diff --git a/services/settings/pkg/store/defaults/defaults.go b/services/settings/pkg/store/defaults/defaults.go index 63a73dcd18..534da706f1 100644 --- a/services/settings/pkg/store/defaults/defaults.go +++ b/services/settings/pkg/store/defaults/defaults.go @@ -33,10 +33,15 @@ const ( // LanguageReadWriteName is the hardcoded setting name for the language read write permission LanguageReadWriteName string = "language-readwrite" - // SetSpaceQuotaPermissionID is the hardcoded setting UUID for the set space quota permission - SetSpaceQuotaPermissionID string = "4e6f9709-f9e7-44f1-95d4-b762d27b7896" - // SetSpaceQuotaPermissionName is the hardcoded setting name for the set space quota permission - SetSpaceQuotaPermissionName string = "set-space-quota" + // SetPersonalSpaceQuotaPermissionID is the hardcoded setting UUID for the set personal space quota permission + SetPersonalSpaceQuotaPermissionID string = "4e6f9709-f9e7-44f1-95d4-b762d27b7896" + // SetPersonalSpaceQuotaPermissionName is the hardcoded setting name for the set personal space quota permission + SetPersonalSpaceQuotaPermissionName string = "set-space-quota" + + // SetProjectSpaceQuotaPermissionID is the hardcoded setting UUID for the set project space quota permission + SetProjectSpaceQuotaPermissionID string = "977f0ae6-0da2-4856-93f3-22e0a8482489" + // SetProjectSpaceQuotaPermissionName is the hardcoded setting name for the set project space quota permission + SetProjectSpaceQuotaPermissionName string = "Drive.ReadWriteQuota.Project" // ListAllSpacesPermissionID is the hardcoded setting UUID for the list all spaces permission ListAllSpacesPermissionID string = "016f6ddd-9501-4a0a-8ebe-64a20ee8ec82" @@ -196,10 +201,25 @@ func generateBundleAdminRole() *settingsmsg.Bundle { }, }, { - Id: SetSpaceQuotaPermissionID, - Name: SetSpaceQuotaPermissionName, - DisplayName: "Set Space Quota", - Description: "This permission allows to manage space quotas.", + Id: SetPersonalSpaceQuotaPermissionID, + Name: SetPersonalSpaceQuotaPermissionName, + DisplayName: "Set Personal Space Quota", + Description: "This permission allows to manage personal space quotas.", + Resource: &settingsmsg.Resource{ + Type: settingsmsg.Resource_TYPE_SYSTEM, + }, + Value: &settingsmsg.Setting_PermissionValue{ + PermissionValue: &settingsmsg.Permission{ + Operation: settingsmsg.Permission_OPERATION_READWRITE, + Constraint: settingsmsg.Permission_CONSTRAINT_ALL, + }, + }, + }, + { + Id: SetProjectSpaceQuotaPermissionID, + Name: SetProjectSpaceQuotaPermissionName, + DisplayName: "Set Project Space Quota", + Description: "This permission allows to manage project space quotas.", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, }, @@ -346,10 +366,10 @@ func generateBundleSpaceAdminRole() *settingsmsg.Bundle { }, }, { - Id: SetSpaceQuotaPermissionID, - Name: SetSpaceQuotaPermissionName, - DisplayName: "Set Space Quota", - Description: "This permission allows to manage space quotas.", + Id: SetProjectSpaceQuotaPermissionID, + Name: SetProjectSpaceQuotaPermissionName, + DisplayName: "Set Project Space Quota", + Description: "This permission allows to manage project space quotas.", Resource: &settingsmsg.Resource{ Type: settingsmsg.Resource_TYPE_SYSTEM, }, diff --git a/sonar-project.properties b/sonar-project.properties index 8f93ecff6b..3efac84b8e 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -38,4 +38,4 @@ sonar.go.golangci-lint.reportPaths=cache/checkstyle/app-provider_checkstyle.xml, # Exclude files sonar.exclusions=**/third_party,docs/**,changelog/**,**/package.json,**/rollup.config.js,CHANGELOG.md,deployments/**,tests/**,vendor-bin/**,README.md,**/mocks/**,/protogen/** sonar.coverage.exclusions=**/*_test.go,**mocks/**,/protogen/** -sonar.cpd.exclusions=**/*_test.go,**/revaconfig/** +sonar.cpd.exclusions=**/*_test.go,**/revaconfig/**,services/settings/pkg/store/defaults/defaults.go