Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix project role docs #21832

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/user-guide/projects.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ spec:
groups:
- some-user
policies:
- p, proj:sample-test-project:some-role, applications, *, *, allow
- p, proj:sample-test-project:admin, applications, *, *, allow
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- p, proj:sample-test-project:admin, applications, *, *, allow
- p, proj:sample-test-project:admin, applications, *, *, allow

This doesn't necessarily need to be an admin role.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't it?
The role name is taken from a few lines above:
0f3d760#diff-d89745b05f3543cc0beea51e5f2a351f604b8ef117448098e65166afa08c70f5R138

and the explanation says:

A role's policy can only grant access to that role.

From that, my understanding is that this must be the admin role.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@klemmster you're right, the name is given a few lines above and policies should use the given role name. I guess another option is to rename the role name to some-role.

...
```

Argo CD will use the policies defined in the AppProject roles while authorizing users actions. To determine which role a given users is associated with, it will dynamically create groups based on the role name in runtime. The project definition above will generate the following Casbin RBAC rules:

```
p, proj:sample-test-project:some-role, applications, *, *, allow
g, some-user, proj:sample-test-project:some-role
p, proj:sample-test-project:admin, applications, *, *, allow
g, some-user, proj:sample-test-project:admin
```

_Note 1_: It is very important that policy roles follow the pattern `proj:<project-name>:<role-name>` or they won't be effective during the Argo CD authorization process.
Expand Down