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

Implement roles in Nextcloud #19903

Open
Baptistou opened this issue Mar 12, 2020 · 10 comments
Open

Implement roles in Nextcloud #19903

Baptistou opened this issue Mar 12, 2020 · 10 comments
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: users and groups

Comments

@Baptistou
Copy link

Baptistou commented Mar 12, 2020

Is your feature request related to a problem? Please describe.
The main problem is that, in medium and large scale, we have to define permissions for a category of users, which are spread into multiple organizational groups, and a same group contains different categories of users which need different features/permissions.
The feature of "Groups" in Nextcloud can be used as both an organizational container of users, e.g. seperating different branches of a company, and a permission container, configured in group whitelists/blacklist in Apps or Admin panel.
Therefore, we have to assign users to at least two groups, one for organizational struture and one for feature permission.
As an undesired result, all those groups are visible and configurable in different and inconsistant places in the interface such as Share list, Talk app, Personal settings, Apps panel, Group folders... which is confusing for both users and admins.
The concept of "Roles" takes on its full meaning here,

Describe the solution you'd like
Please implement the concept of "Roles" in Nextcloud to separate organizational struture and user permissions.
Permissions should be configurable in one unique and centralized place related to roles.
Moreover, the user should not be aware of the role he belongs to, this is a technical information only handled by admins.

Describe alternatives you've considered
When I have to restrict feature access to some users, I have to create a group, assign users to it, update authorized group whitelist in different places in Apps panel and/or in Admin panel (e.g. Talk app, Group Folder).
This is really not convenient.

@Baptistou Baptistou added 0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement labels Mar 12, 2020
@kesselb

This comment has been minimized.

@Baptistou Baptistou changed the title Implement roles in NextCloud Implement roles in Nextcloud Mar 12, 2020
@Baptistou

This comment has been minimized.

@benjamindahl
Copy link

From a data protection point of view, I'm looking for a similar feature.
I want to hide specific groups from others and give access to specific features to single users. A more precise permission assignment to groups is really needed.

@stovesy
Copy link

stovesy commented May 13, 2020

I agree in part here. Conditional access to applications based on user 'groups' would be good. An instance here is where we have 'guest' users out of our company, we don't want to provision calendar, tasks etc to these users, merely file access.
Thanks

@summersab
Copy link
Contributor

I'm adding my support for this feature request (#7482 may be related, by the way). There is a dire need for more granular permissions/roles for users and administrators. This could be done in a number of ways:

  • Adding more user "types" like Admin, Group Admin, Manager, User, Consultant, Guest, etc. Each of these groups has different permissions.
  • Granular permissions for users, groups, roles, etc.
  • A combination of the above.

Obviously, the first option is easiest while the second is the hardest. There are a number of factors at play:

  • How granular do things go? Are we talking Active Directory-level of control?
  • Should it be possible to add new app-based permissions? This would require developing some sort of hooks.
  • How does this tie in with other user management systems like LDAP?

I think this is a pretty important feature. It's certainly a huge undertaking, but it should be a fairly high priority, in my opinion. I just started really digging into the code tonight, and I'm trying to figure out where to start. Feedback from people more familiar with the structure of the code would certainly be appreciated.

@summersab
Copy link
Contributor

summersab commented Jun 18, 2020

I found two RBAC libraries for PHP:
https://github.com/OWASP/rbac
https://github.com/php-casbin/php-casbin

On one hand, OWASP is one of the "gold standards" in security. On the other hand, Casbin is a more active project, and it has more cross-language support (might be helpful if Nextcloud ever begins supporting plugins/add-ons in different languages down the road). Also, there are some pretty noteworthy projects using Casbin, apparently. That makes me lean toward that project as a starting point.

Edit: Oh, dear - Casbin uses conf and csv flat-files instead of storing the configs in a database. That's a no-go. PHP-RBAC uses a database.

Also, it looks like this fork added Postgres support, so that may be important:
https://github.com/jamesvl/rbac

@summersab
Copy link
Contributor

summersab commented Jun 22, 2020

Okay, I believe I understand how this works. NC uses annotations to set permissions throughout the controller classes. It uses things like:

@NoAdminRequired
@NoSubadminRequired
@NoCSRFRequired
@PasswordConfirmationRequired

If these are set in the PHPDoc before the function, the system performs security checks. This . . . is kinda gross. I mean, it works, but it seems like a shoe-horned solution, and I didn't find it to be well-documented at all.

To add RBAC support, new structures need to be added to the DB to contain permissions for users. Then, the hasAnnotation calls need to be edited to check for user permissions. The list of available annotations should be expanded to allow granular control over specific functions. Lastly, a new page needs to be added (or a current page modified) to provide a way to manage permissions from the web GUI.

All-in-all, not impossible to do, and it shouldn't take that long. However, I would want to work in conjunction with one of the NC devs before attempting to overhaul something like this on my own without their input.

@hsluoyz
Copy link

hsluoyz commented Jun 23, 2020

@summersab Casbin supports to store policy into a lot of DBs via adapter: https://casbin.org/docs/en/adapters . Most of those ORM adapters support PostgreSQL.

@szaimen
Copy link
Contributor

szaimen commented Jun 2, 2021

cc @nextcloud/server-triage is this something we want in the long term?

@skjnldsv
Copy link
Member

skjnldsv commented Jun 3, 2021

cc @nextcloud/server-triage is this something we want in the long term?

Might be with circles in the long run

@szaimen szaimen added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap needs info labels Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement feature: users and groups
Projects
None yet
Development

No branches or pull requests

8 participants