Skip to content

Commit

Permalink
updated permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriia-ruban committed Aug 29, 2023
1 parent 0ae1db8 commit c0110e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ui/packages/consul-ui/app/abilities/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default class PolicyAbility extends BaseAbility {
get canWrite() {
return (
this.env.var('CONSUL_ACLS_ENABLED') &&
(typeof this.item === 'undefined' || typeOf([this.item]) !== 'policy-management') &&
(typeof this.item === 'undefined' ||
!['policy-management', 'read-only'].includes(typeOf([this.item]))) &&
super.canWrite
);
}
Expand Down
17 changes: 17 additions & 0 deletions ui/packages/consul-ui/mock-api/v1/acl/policies
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ ${typeof location.search.partition !== 'undefined' ? `
}
`
}
if(i === 2) {
return `
{
"ID": "00000000-0000-0000-0000-000000000002",
"Name": "global-read-only",
${typeof location.search.ns !== 'undefined' ? `
"Namespace": "${location.search.ns}",
` : ``}
${typeof location.search.partition !== 'undefined' ? `
"Partition": "${location.search.partition}",
` : ``}
"Description": "Built-In Read-only Policy",
"CreateIndex": 10,
"ModifyIndex": 10
}
`
}
return `
{
"ID": "${fake.random.uuid()}",
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/consul-ui/mock-api/v1/acl/policy/_
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ ${ location.pathname.get(3) !== '00000000-0000-0000-0000-000000000001' ? `
policy = "write"
}`)},
` : "" }
"Name": "${location.pathname.get(3) === '00000000-0000-0000-0000-000000000001' ? 'global-management' : fake.hacker.noun() + '-policy'}"
"Name": "${location.pathname.get(3) === '00000000-0000-0000-0000-000000000001' ? 'global-management' : location.pathname.get(3) === '00000000-0000-0000-0000-000000000002' ? 'global-read-only': fake.hacker.noun() + '-policy'}"
}

0 comments on commit c0110e3

Please sign in to comment.