galasa-dev / projectmanagement

Project Management repo for Issues and ZenHub
7 stars 4 forks source link

RBAC: foundation #2041

Open techcobweb opened 3 weeks ago

techcobweb commented 3 weeks ago

Story

As a galasa service admin I can set a role for a particular user as default or admin , and some actions are possible by admin users, and some are not possible if a user only has a default role, so that my system is more protected from damage by regular galasa service users.

Background

The aim of this story is to create functions within the framework code and REST APIs which have hard-coded responses for default and admin user roles, which control some actions, and adding a user role field to the user record. ie: A few fixed roles which can't be edited.

Levels of role:

A default user has the least amount of privilege.

An admin user has the highest level of privilege. They can do anything that Galasa supports.

Some admins are on an 'initial-admin' list, maintained at the kubernetes level. Such users can't be demoted to non-admins without the kubernetes configuration being altered. It that sense they are 'protected admins' but still have normal admin rights.

We played with the idea of having a different role to represent these 'protected admin' people, like 'owner' or similar, but it just makes things more complex when it comes to special-casing what such people can do.

How does the first user get admin access ?

We have the problem in that how do we know who to set up as the first admin user, so they can grant admin privileges to other admin users ?

ways we could go:

Promoting someone to be an admin/ Recovering a system

It may be that the admin of the system has left the company or no longer works with the real responsibility associated with the ownership. It may be that there are no active administrators on the system doing the actual admin tasks. In such cases, how do you 'anoint' someone with admin rights ?

You get this situation when you first install the Galasa service. There are no administrators.

To create a system admin you need to do this:

Demoting someone who is an initial admin to be a regular user

Deleting administrators

Any admin can delete an admin. If the user deleted is on the initial-admin list still, and the user logs in again, they will be set up as an admin.

If they are first removed from the initial-admin list config map, then deleted, they will be set up as a default user like everyone else when they next log in.

You can delete an init-admin, just like you can delete an admin, but you can't stop someone being an admin if they are on the initial-admin list without first changing the config map to remove them from that list.

Tasks

For example:

techcobweb commented 3 weeks ago

@jadecarino @aashir21 I spoke to @hobbit1983 and he made the point that all CPS properties should be protected from regular non-admin users. We should be encouraging users to use overrides if they want to change anything, and let the CI/CD pipelines maintain the CPS properties using config as code, or at least only let admins change CPS properties. I agree. Story text above changed to reflect that.

techcobweb commented 3 weeks ago

@jadecarino @aashir21 I also updated the story to include details of how the first admin is 'anointed' or how a system with no active admins can be recovered. Hope that detail is clear and fit for purpose. If you think of a better way of doing it lets talk!