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

RBAC Docs #2486

Merged
merged 1 commit into from
May 4, 2022
Merged

RBAC Docs #2486

merged 1 commit into from
May 4, 2022

Conversation

pavelpicka
Copy link
Contributor

@pavelpicka pavelpicka commented Apr 11, 2022

RBAC documentation.

closes #2506
#2506

docs/rbac.rst Outdated

.. important::

Using user ``admin`` will bypass all RBAC checks.
Copy link
Contributor

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 :)

Copy link
Contributor Author

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"

Copy link
Member

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`.
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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
Copy link
Contributor

@dralley dralley Apr 14, 2022

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
Copy link
Contributor

@dralley dralley Apr 14, 2022

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.

docs/rbac.rst Outdated
Comment on lines 233 to 235
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.
Copy link
Member

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"}]'
Copy link
Member

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.

Copy link
Contributor Author

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.

@pavelpicka pavelpicka force-pushed the rpm_rbac_docs branch 3 times, most recently from 0ab6afb to 5a058f7 Compare April 25, 2022 13:59
docs/rbac.rst Outdated
Viewer Role
^^^^^^^^^^^

This role contains only ``view`` permission for an `endpoint`. Using this permission you can control who can
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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" \
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Contributor

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" \
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Member

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...

@pavelpicka pavelpicka requested a review from dralley April 25, 2022 17:11
Copy link
Contributor

@dralley dralley left a 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?


User ``admin`` automatically gets all RBAC permissions.

RPM plugin presents Role Based Access for these endpoints :
Copy link
Member

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?

Copy link
Contributor Author

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.

@ipanova
Copy link
Member

ipanova commented Apr 29, 2022

@pavelpicka please whether reference this issue you are going ti create #2418 (review) or file a separate doc issue

RBAC documentation.

closes pulp#2506
pulp#2506
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a user, I'd like to have documentation for RBAC
4 participants