-
Notifications
You must be signed in to change notification settings - Fork 123
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
RBAC Docs #2486
RBAC Docs #2486
Conversation
5b6685c
to
3bca77b
Compare
docs/rbac.rst
Outdated
|
||
.. important:: | ||
|
||
Using user ``admin`` will bypass all RBAC checks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it actually bypass the checks or does the admin simply possess every permission? I thought it was the latter https://github.com/pulp/pulp_rpm/pull/2418/files#diff-37aef788d3a12e65873c374ff05bc8629a8b636cab51ac31c127f94d43f1314eR234
The end result is the same but we should properly communicate what's going on :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rephrased to "admin gets all permissions"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The admin is assumed to have all the permissions (even before asking any permission backend). But the access policy can still disallow any access. So there is actually a difference in the end result.
docs/rbac.rst
Outdated
Using user ``admin`` will bypass all RBAC checks. | ||
|
||
|
||
* `Permission` : Permission to do **one** action on one `viewset` as a `view` or a `create`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should "as a" be ", for example" or "e.g."? I'm not sure what the intention is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section should explain basic terms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I would remove it.
docs/rbac.rst
Outdated
|
||
* `Permission` : Permission to do **one** action on one `viewset` as a `view` or a `create`. | ||
|
||
* `Model Permission` : a permission for a model type, it means you can do this action on any object of the model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these docs meant to be for the user or for the plugin writer? If they're for a user, I would avoid using terms like "model" and "viewset" and use more generic terms like object or API endpoint.
docs/rbac.rst
Outdated
Viewer Role | ||
^^^^^^^^^^^ | ||
|
||
This role contains only ``view`` permission for a `viewset`. Using this permission you can control who can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As with above, most users won't know what a viewset is. Repeated a few times below.
9f99703
to
c55d53d
Compare
docs/rbac.rst
Outdated
If a role contains multiple permissions over different objects, then you can't assign this role to a specific object. | ||
Trying to assign the role to a single object will fail. | ||
For example, if a role contains ``add`` permission, you must use the empty ``--object`` param. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not true.
Having the add
permission on an object does not lead anywhere, but it's possible.
Also assigning a role to an object is possible if at least one of it's permissions is applicable to that object.
docs/rbac.rst
Outdated
.. code-block:: shell | ||
:caption: Change the access policy of the retrieve action without requiring any permission. | ||
|
||
pulp access-policy update --viewset-name "remotes/rpm/rpm" --statements '[{"action": "retrieve", "effect": "allow"}]' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is dangerous, as it deletes all but the retrieve action from this viewset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and reflect this information to the doc as well.
0ab6afb
to
5a058f7
Compare
docs/rbac.rst
Outdated
Viewer Role | ||
^^^^^^^^^^^ | ||
|
||
This role contains only ``view`` permission for an `endpoint`. Using this permission you can control who can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if endpoint
needs to be a keyword
docs/rbac.rst
Outdated
^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
This role is like a pulp admin but only for the RPM plugin. | ||
You can perform every RPM workflow. If you need a more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This role is like a pulp admin but only for the RPM plugin - it can perform any RPM workflow with no restrictions.
docs/rbac.rst
Outdated
To find out which permissions you need for a new role, you can list an endpoints policy with the following command: | ||
|
||
.. code-block:: shell | ||
:caption: List an access policy of the repository endpoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this lists many role names then it should be phrased as "List possible access policies for the repository endpoint"
Maybe you should include example output?
:caption: Change the access policy of all actions not requiring any permission. | ||
|
||
pulp access-policy update \ | ||
--viewset-name "remotes/rpm/rpm" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is viewset-name
already baked into the CLI or is this something new? It would be better to use generic terms here as well (even though it's not part of this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
viewset-name
is already in the CLI and already used in a few more plugins so changing it wouldn't be so easy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is unfortunate. @mdellweg Do you think this would be a worthwhile change, or do you think the cost would outweigh the benefit? If we have to carry around the old commands indefinitely it's probably not worth it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing that i was told cannot change is the parameter in the REST api. The cli is just following the bad naming for consistency and less confusion and i'd rather keep it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
docs/rbac.rst
Outdated
.. code-block:: shell | ||
:caption: Update creation hook of a repository to creator gets another role than `repository_owner` | ||
|
||
pulp access-policy update --href "repositories/rpm/rpm" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is --href "repositories/rpm/rpm"
correct? What is the difference between --href
and --viewset-name
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--viewset-name
is a better option in this place. --href
is intended to use with the already created object.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes href would not work...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @pavelpicka
Could you please squash these commits before the PR gets merged?
373ad6d
to
4a819a9
Compare
|
||
User ``admin`` automatically gets all RBAC permissions. | ||
|
||
RPM plugin presents Role Based Access for these endpoints : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about copy, compsxml and rest of the content?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added note about the content and rpm copy.
@pavelpicka please whether reference this issue you are going ti create #2418 (review) or file a separate doc issue |
55999df
to
02e62fe
Compare
RBAC documentation.
closes #2506
#2506