-
Notifications
You must be signed in to change notification settings - Fork 17.7k
Fixing overwrite and save slice permissions for a give role #298
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
91bac04
Fixing overwrite and save slice permissions for a give role
b828f4b
fix function name - build failed
5f4c5aa
fix function name and test user permissions
c1c31c3
disable the button in the UI
f962522
fix build error - characters too long in 1 line
f983a7d
try to disable button on the UI
8956077
disable cursor in caravel css. You wont be able to click anymore if n…
aa6de79
fix build issues
77c2d9d
Merge branch 'master' into slice_permissions
36f21f4
Merge branch 'master' into slice_permissions
sid88in fe0e7db
fix build errors! god bless me
86d9312
disable main features in dashboard and slice
15649d4
Merge branch 'master' of https://github.com/airbnb/caravel into slice…
7afc5fe
fix build issues
23303dd
Merge branch 'master' into slice_permissions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -468,7 +468,7 @@ def explore(self, datasource_type, datasource_id): | |
|
|
||
| action = request.args.get('action') | ||
| if action in ('save', 'overwrite'): | ||
| return self.save(request.args, slc) | ||
| return self.saveoroverwriteslice(request.args, slc) | ||
|
|
||
| viz_type = request.args.get("viz_type") | ||
| if not viz_type and datasource.default_endpoint: | ||
|
|
@@ -522,9 +522,8 @@ def explore(self, datasource_type, datasource_id): | |
| mimetype="application/json") | ||
| return resp | ||
|
|
||
| def save(self, args, slc): | ||
| def saveoroverwriteslice(self, args, slc): | ||
| """Saves (inserts or overwrite a slice) """ | ||
| session = db.session() | ||
| slice_name = args.get('slice_name') | ||
| action = args.get('action') | ||
|
|
||
|
|
@@ -549,9 +548,6 @@ def save(self, args, slc): | |
|
|
||
| if action == "save": | ||
| slc = models.Slice() | ||
| msg = "Slice [{}] has been saved".format(slice_name) | ||
| elif action == "overwrite": | ||
| msg = "Slice [{}] has been overwritten".format(slice_name) | ||
|
|
||
| slc.params = json.dumps(d, indent=4, sort_keys=True) | ||
| slc.datasource_name = args.get('datasource_name') | ||
|
|
@@ -561,13 +557,28 @@ def save(self, args, slc): | |
| slc.datasource_type = datasource_type | ||
| slc.slice_name = slice_name | ||
|
|
||
| if action == "save": | ||
| session.add(slc) | ||
| elif action == "overwrite": | ||
| session.merge(slc) | ||
| if action == 'save': | ||
| self.save_slice(slc) | ||
| elif action == 'overwrite': | ||
| self.overwrite_slice(slc) | ||
|
|
||
| return redirect(slc.slice_url) | ||
|
|
||
| @has_access | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I think this will create new view related permissions, where we should instead use the already defined model permissions using |
||
| def save_slice(self, slc): | ||
| session = db.session() | ||
| msg = "Slice [{}] has been saved".format(slc.slice_name) | ||
| session.add(slc) | ||
| session.commit() | ||
| flash(msg, "info") | ||
|
|
||
| @has_access | ||
| def overwrite_slice(self, slc): | ||
| session = db.session() | ||
| msg = "Slice [{}] has been overwritten".format(slc.slice_name) | ||
| session.merge(slc) | ||
| session.commit() | ||
| flash(msg, "info") | ||
| return redirect(slc.slice_url) | ||
|
|
||
| @has_access | ||
| @expose("/checkbox/<model_view>/<id_>/<attr>/<value>", methods=['GET']) | ||
|
|
||
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.
underscore_between_words_please