Skip to content

Conversation

jjmerchante
Copy link
Contributor

This PR allows defining permission groups to manage the platform.

By default, three permission groups are available: admin, user, and readonly. Admins and users can create and update tasks and repositories, while readonly users have view-only access.

A new command is available. grimoirelab admin set-permissions <username> <permission_group> allows assigning a specific permission group to a user.

To add custom groups or adjust permissions, create a new JSON file based on
grimoirelab/core/settings/permissions_groups.json, and set the environment variable
GRIMOIRELAB_PERMISSION_GROUPS_LIST_PATH to the path of the new file.

This commit allows defining permission groups to manage the platform.

By default, three permission groups are available: admin, user, and readonly.
Admins and users can create and update tasks and repositories, while readonly
users have view-only access.

A new command is available:
`grimoirelab admin set-permissions <username> <permission_group>`
This allows assigning a specific permission group to a user.

To add custom groups or adjust permissions, create a new JSON file based on
`grimoirelab/core/settings/permissions_groups.json`, and set the environment
variable `GRIMOIRELAB_PERMISSION_GROUPS_LIST_PATH` to the path of the new file.

Signed-off-by: Jose Javier Merchante <[email protected]>
Copy link
Member

@sduenas sduenas left a comment

Choose a reason for hiding this comment

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

I think we should have three groups of roles (at least for now):

  • Admin: user with super powers for everything, specially manage tasks and identities.
  • Manager: user to administer a set of ecosystems: add, archive and remove repositories from the ecosystem . They can't manage tasks but probably identities from
  • Member: user with access to a set of ecosystems. For the moment, they can only view the info related to it. Probably, also get data and metrics using the API.

What do you think about this?

def check_permissions(permissions):
"""
Decorator to check if the user has the given permissions.
This only works for RestFramework views.
Copy link
Member

Choose a reason for hiding this comment

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

What are the implications of this? I'm afraid there could be other ways to call the API, etc and have a security hole because we don't remember this only works for the RestFramework views.

click.echo()


def _setup_group_permissions():
Copy link
Member

Choose a reason for hiding this comment

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

Maybe I made this command before but, shouldn't this be a fixture? It can be like what we have in SortingHat for countries.

self.assertEqual(response.status_code, 403)
self.assertEqual(response.json(), {"detail": "Authentication credentials were not provided."})

def test_add_repository_permission_denied(self):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can have something generic to try the permissions of specific actions.

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.

2 participants