Skip to content

Commit 9590a05

Browse files
authored
Merge pull request #70 from MaxMcAdam/anax-3980
Issue #3980 - Bug: regurlar user is not able to list all the user sec…
2 parents 2369d96 + bfb2336 commit 9590a05

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plugin/policy.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const USER_PRIVATE_DENY_POLICY2 = `path "openhorizon/metadata/%s/user/*" {capabi
2626
// All supported openhorizon users will have these policies attached.
2727
const USER_PRIVATE_POLICY1 = `path "openhorizon/data/%s/user/%s/*" {capabilities = ["create", "update", "read"]}`
2828
const USER_PRIVATE_POLICY2 = `path "openhorizon/metadata/%s/user/%s/*" {capabilities = ["list", "read", "delete"]}`
29+
const USER_PRIVATE_POLICY3 = `path "openhorizon/metadata/%s/user/%s" {capabilities = ["list"]}`
2930

3031
// Ensure that the right ACL policies exist so that they can be attached to the user's token.
3132
func (o *ohAuthPlugin) setupUserPolicies(userOrg string, userId string, admin bool, vaultToken string) (policyName string, err error) {
@@ -166,7 +167,8 @@ func getPolicyString(userOrg string, userId string, admin bool) (policyString st
166167
adminUserPrivateDeny2 := fmt.Sprintf(USER_PRIVATE_DENY_POLICY2, userOrg)
167168
userPrivatePolicy1 := fmt.Sprintf(USER_PRIVATE_POLICY1, userOrg, userId)
168169
userPrivatePolicy2 := fmt.Sprintf(USER_PRIVATE_POLICY2, userOrg, userId)
169-
policyString = fmt.Sprintf("%s %s %s %s %s", nonAdminPolicy, adminUserPrivateDeny1, adminUserPrivateDeny2, userPrivatePolicy1, userPrivatePolicy2)
170+
userPrivatePolicy3 := fmt.Sprintf(USER_PRIVATE_POLICY3, userOrg, userId)
171+
policyString = fmt.Sprintf("%s %s %s %s %s %s", nonAdminPolicy, adminUserPrivateDeny1, adminUserPrivateDeny2, userPrivatePolicy1, userPrivatePolicy2, userPrivatePolicy3)
170172
}
171173

172174
return

0 commit comments

Comments
 (0)