mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 10:00:17 -04:00
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).
48 lines
1.9 KiB
JavaScript
48 lines
1.9 KiB
JavaScript
(function () {
|
|
var DataSourcesCtrl = function ($scope, $location, growl, Events, DataSource) {
|
|
Events.record(currentUser, "view", "page", "admin/data_sources");
|
|
$scope.$parent.pageTitle = "Data Sources";
|
|
|
|
$scope.dataSources = DataSource.query();
|
|
|
|
$scope.openDataSource = function(datasource) {
|
|
$location.path('/data_sources/' + datasource.id);
|
|
};
|
|
|
|
$scope.deleteDataSource = function(event, datasource) {
|
|
event.stopPropagation();
|
|
Events.record(currentUser, "delete", "datasource", datasource.id);
|
|
datasource.$delete(function(resource) {
|
|
growl.addSuccessMessage("Data source deleted successfully.");
|
|
this.$parent.dataSources = _.without(this.dataSources, resource);
|
|
}.bind(this), function(httpResponse) {
|
|
console.log("Failed to delete data source: ", httpResponse.status, httpResponse.statusText, httpResponse.data);
|
|
growl.addErrorMessage("Failed to delete data source.");
|
|
});
|
|
}
|
|
};
|
|
|
|
var DataSourceCtrl = function ($scope, $routeParams, $http, $location, Events, DataSource) {
|
|
Events.record(currentUser, "view", "page", "admin/data_source");
|
|
$scope.$parent.pageTitle = "Data Sources";
|
|
|
|
$scope.dataSourceId = $routeParams.dataSourceId;
|
|
|
|
if ($scope.dataSourceId == "new") {
|
|
$scope.dataSource = new DataSource({options: {}});
|
|
} else {
|
|
$scope.dataSource = DataSource.get({id: $routeParams.dataSourceId});
|
|
}
|
|
|
|
$scope.$watch('dataSource.id', function(id) {
|
|
if (id != $scope.dataSourceId && id !== undefined) {
|
|
$location.path('/data_sources/' + id).replace();
|
|
}
|
|
});
|
|
};
|
|
|
|
angular.module('redash.controllers')
|
|
.controller('DataSourcesCtrl', ['$scope', '$location', 'growl', 'Events', 'DataSource', DataSourcesCtrl])
|
|
.controller('DataSourceCtrl', ['$scope', '$routeParams', '$http', '$location', 'Events', 'DataSource', DataSourceCtrl])
|
|
})();
|