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
Add: share modify/access permissions for queries and dashboard #1113
Merged
arikfr
merged 29 commits into
getredash:master
from
whummer:feat/share-access-permissions
Oct 28, 2016
Merged
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2a68820
UI for sharing edit permissions
903ba0c
add backend API and tests for managing access permissions.
whummer 91a46ea
add optimistic locking for concurrent changes to queries by different…
whummer 95dca53
Finalised UI for sharing permissions
6b540e0
check for shared permissions in dashboard UI
whummer e0672f4
add optimistic locking for dashboard editing
whummer c0c4f45
fix handling of latest_version in query view
whummer 60a79cb
address code review comments
whummer b748eb1
"Simplify" migration code
arikfr 19e5a0a
Naming and indentation fixes
arikfr b9ab913
Apply review to models code
arikfr 00a77f8
snake_case to camelCase
arikfr 7ba5a20
Remove unused method
arikfr 9f3bbfe
Renames
arikfr c51477a
Add tests outline
arikfr edea6f3
WIP:
arikfr 8b09112
Use new helper for dashboards API
arikfr bb96702
Update dashboard testS
arikfr 40cc592
Make sure error are logged in tests
arikfr f34471e
Return 409 when dashboard can't be updated due to conflict
arikfr 6218421
Tests for the permissions API (and rewrite)
arikfr 8245a66
Return permission state with query object
arikfr 028393b
Return dashboard permission status with dashboard object
arikfr df17759
Fix tests
arikfr 9cb9bdb
Record events for permission changes
arikfr 6c5dd09
Add change tracking and fix tests
arikfr 2592959
Use version for partial query updates
arikfr 52b87ef
Add feature flag for the permissions control feature
arikfr fd9dc4b
Update controller/view name
arikfr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ node_modules | |
.tmp | ||
.sass-cache | ||
rd_ui/app/bower_components | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from redash.models import db, Change, AccessPermission, Query, Dashboard | ||
from playhouse.migrate import PostgresqlMigrator, migrate | ||
|
||
if __name__ == '__main__': | ||
|
||
if not Change.table_exists(): | ||
Change.create_table() | ||
|
||
if not AccessPermission.table_exists(): | ||
AccessPermission.create_table() | ||
|
||
migrator = PostgresqlMigrator(db.database) | ||
|
||
try: | ||
migrate( | ||
migrator.add_column('queries', 'version', Query.version), | ||
migrator.add_column('dashboards', 'version', Dashboard.version) | ||
) | ||
except Exception as ex: | ||
print "Error while adding version column to queries/dashboards. Maybe it already exists?" | ||
print ex | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<div class="modal-header"> | ||
<button type="button" class="close" aria-label="Close" ng-click="close()"><span aria-hidden="true">×</span></button> | ||
<h4 class="modal-title">Manage Permissions</h4> | ||
</div> | ||
<div class="modal-body"> | ||
<div style="overflow: auto; height: 300px"> | ||
<ui-select ng-model="newGrantee.selected" on-select="addGrantee($item)"> | ||
<ui-select-match placeholder="Add New User"></ui-select-match> | ||
<ui-select-choices repeat="user in foundUsers | filter:$select.search" | ||
refresh="findUser($select.search)" | ||
refresh-delay="0" | ||
ui-disable-choice="user.alreadyGrantee"> | ||
<div> | ||
<img ng-src="{{user.gravatar_url}}" height="24px"> {{user.name}} | ||
<small ng-if="user.alreadyGrantee">(already has permission)</small> | ||
</div> | ||
</ui-select-choices> | ||
</ui-select> | ||
<br/> | ||
<table class="table table-condensed table-hover"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th>User</th> | ||
<th>Permission</th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr ng-repeat="grantee in grantees"> | ||
<td width="50px"><img ng-src="{{grantee.gravatar_url}}" height="40px"/></td> | ||
<td>{{grantee.name}} </td> | ||
<td>{{grantee.access_type}}</td> | ||
<td><button class="pull-right btn btn-sm btn-danger" ng-click="removeGrantee(grantee)">Remove</button></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of queries, we need to filter here for users who have full access to the query data source. Ideally it's something we will let the backend do, to avoid replicating logic in the UI.
We can postpone implementing this to the end, as it doesn't change the interface behavior.