Skip to content

Commit

Permalink
Merge pull request #519 from EverythingMe/feature/disable_collaborati…
Browse files Browse the repository at this point in the history
…ve_editing

Feature: ability to disable the ability to edit anyone's query by everyone
  • Loading branch information
arikfr committed Aug 1, 2015
2 parents d155f16 + 3a56b9d commit 464402a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rd_ui/app/scripts/controllers/query_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
saveQuery = $scope.saveQuery;

$scope.sourceMode = true;
$scope.canEdit = true;
$scope.canEdit = currentUser.canEdit($scope.query) || featureFlags.allowAllToEditQueries;
$scope.isDirty = false;

$scope.newVisualization = undefined;
Expand Down
7 changes: 5 additions & 2 deletions redash/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def index(**kwargs):
}

features = {
'clientSideMetrics': settings.CLIENT_SIDE_METRICS
'clientSideMetrics': settings.CLIENT_SIDE_METRICS,
'allowAllToEditQueries': settings.FEATURE_ALLOW_ALL_TO_EDIT_QUERIES
}

return render_template("index.html", user=json.dumps(user), name=settings.NAME,
Expand Down Expand Up @@ -391,7 +392,9 @@ def post(self, query_id):
if 'data_source_id' in query_def:
query_def['data_source'] = query_def.pop('data_source_id')

query_def['last_modified_by'] = self.current_user
# Don't set "last_modified_by" if the user only refreshing this query
if not ('latest_query_data' in query_def and len(query_def.keys()) == 1):
query_def['last_modified_by'] = self.current_user

# TODO: use #save() with #dirty_fields.
models.Query.update_instance(query_id, **query_def)
Expand Down
1 change: 1 addition & 0 deletions redash/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ def all_settings():
])))

# Features:
FEATURE_ALLOW_ALL_TO_EDIT_QUERIES = parse_boolean(os.environ.get("REDASH_FEATURE_ALLOW_ALL_TO_EDIT", "true"))
FEATURE_TABLES_PERMISSIONS = parse_boolean(os.environ.get("REDASH_FEATURE_TABLES_PERMISSIONS", "false"))

0 comments on commit 464402a

Please sign in to comment.