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

Feature: new permission model #724

Merged
merged 2 commits into from
Jan 4, 2016
Merged

Feature: new permission model #724

merged 2 commits into from
Jan 4, 2016

Conversation

arikfr
Copy link
Member

@arikfr arikfr commented Dec 25, 2015

This pull request implements new permission model (explained below) and interface for adding groups and associating members with groups. It implements most of the functionality of #636, except for per query permissions.

New Permission Model

Until now each user had one or more groups associated with him, from which he derived the actions he permitted to do in the system (execute query, run query, create dashboard, etc). With this pull request I add another dimension to this: each datasource is associated with the groups that can access it, where access is either full access or just read access (read existing queries).

This simple model should allow a variety of use cases, but in the future I can see two enhancements to it:

  • Per query permissions, i.e. the ability to extend the access scope of a single query, vs. the whole data source. It's actually not a large change in the code base, and mainly about adding the API to extend the groups and the UI.
  • Ability to share a URL that gives access to a single query, similar to the embed functionality @akariv implemented in Feature: ability to embed visualizations in external sites #664.

How does it work?

  • As before, each user belongs to one or more groups. By default each user joins the "Default" group. So the common datasources, should be associated with this group.
  • Once this merged, each datasource will be associated with one or more groups. Each connection to a group will define, whether this group has full access to this data source (view existing queries and run new ones) or view only access, which allows only viewing existing queries and results.
  • Any dashboard can contain visualizations from any data source (as long as the creating user has access to them). When a user who doesn't have access to some visualization (because he doesn't have access to the datasource) opens a dashboard, he will see that there is a visualization there but won't see the details.

image

image

image

What if I want to limit the user to only some tables?

The idea is to leverage your database's security model, and hence create a user with access to the tables/columns you want to give access to, create a datasource that is using this user and then associate it with a group of users who need this level of access.

Previously each group had a tables property, which was used for a similar purpose, this is now removed. It wasn't fully safe, and I believe it's better to rely on the database's security model. If you were using this, please update your datasources accordingly.

Organizations

In this pull request I'm also introducing "Organizations", which is a way to partition data in your re:dash instance beyond groups. While groups allow you to manage who can access individual queries/datasources, the users and dashboards are visible to everyone. With an organization you can create a "silo", where each organization has its own users, datasources, dashboards and groups.

It's irrelevant to most of the users, and I tried to minimize the impact on the source code. Its purpose is to serve as basis for a hosted re:dash service (SaaS), I'm going to introduce (I will share more details soon).

Backward Incompatible Changes

There are some backward incompatible changes in this pull request:

  • As mentioned above, the tables property in groups (and feature) was removed. If you used this, please create the relevant datasources when migrating.
  • If you had some additional groups beyond the default ones, default and admin, I recommend reviewing the changes and making sure that they don't affect you.

(Closes #580)

@arikfr arikfr added this to the v0.9 milestone Dec 25, 2015
@toyama0919
Copy link
Contributor

Awesome😍

@arikfr arikfr force-pushed the feature/permissions branch 2 times, most recently from 4997028 to 2732f6d Compare December 28, 2015 15:29
This is one huge change for the permissions system and related:

* (Backward incompatible:) Remove the table based permissions in favour of the new model.
* Manage permission to view or query datasources based on groups.
* Add the concept of Organization. It's irrelevant for most deployments, but allows for
  multi-tenant support in re:dash.
* Replace ActivityLog with Event based rows (old data in activity_log table is retained).
* Enforce permissions on the server-side. There were some permissions that were only enforced
  on the client side. This is no more. All permissions are enforced by the server.
* Added new permission: 'super-admin' to access the status and Flask-Admin interface.
* Make sure that html is never cached by the browser - this is to make sure that the browser
  will always ask for the new Javascript/CSS resources (if such are available).
@arikfr arikfr changed the title [WIP] Feature: new permission model Feature: new permission model Dec 31, 2015
To avoid complications with how Google Auth works, when enabling organization
multi-tenancy on a single instance, each organization becomes a "sub folder"
instead of a sub-domain.
arikfr added a commit that referenced this pull request Jan 4, 2016
@arikfr arikfr merged commit cb4fbf8 into master Jan 4, 2016
@MaxPleaner
Copy link

Curious if this will be added to the AWS images soon? I just launched mine and am trying to figure out how to implement access control .

@arikfr
Copy link
Member Author

arikfr commented Jan 19, 2016

I'm planning to create new images tomorrow. But until then you can just run
the upgrade process (documented in the docs).

On Wednesday, 20 January 2016, Max Pleaner notifications@github.com wrote:

Curious if this will be added to the AWS images soon? I just launched mine
and am trying to figure out how to implement access control .


Reply to this email directly or view it on GitHub
#724 (comment).

Arik Fraimovich

@Xangis
Copy link
Contributor

Xangis commented Jan 19, 2016

Please be sure to update system patches on your AMI. The existing AMIs are old enough that they have some unpatched vulnerabilities.

@arikfr
Copy link
Member Author

arikfr commented Jan 20, 2016

@Xangis sure. I'm always taking the latest Ubuntu base image.

@TonyStarkBy
Copy link

When a user who doesn't have access to some visualization (because he doesn't have access to the datasource) opens a dashboard, he will see that there is a visualization there but won't see the details.

It will be great if it will be possible to set access to whole dashboard by groups.

Example:

  • I have project A and project B, for each project i have dashboards: dashboard-A and dashboard-B
  • I have two groups with users: group-mangagers-project-A and group-mangagers-project-B
  • i want to restrict access to this dashboards by user group

@TonyStarkBy
Copy link

And one more thing - "read only" status to group. Users in this group can't edit/view SQL source :)

@arikfr
Copy link
Member Author

arikfr commented Jan 28, 2016

@TonyStarkBy

While both groups will see that both dashboards exists, each group will be able to see the contents of only its own dashboards.

And one more thing - "read only" status to group. Users in this group can't edit/view SQL source :)

This already exists: you can set that a group has permission to only view queries on some (or all) data sources.

@TonyStarkBy
Copy link

This already exists: you can set that a group has permission to only view queries on some (or all) data sources.

I already try this, but users can view SQL query (only button "Execute" was disabled) and can edit charts.

@teguhn
Copy link

teguhn commented Jun 10, 2016

Is there any documentation on how to create "Organizations"? Thanks

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.

None yet

6 participants