Merge pull request #134 from coreos-inc/permapprove

Default to the read role in the permissions table
This commit is contained in:
Jimmy Zelinskie 2015-06-16 17:37:46 -04:00
commit 7315736c1f

View file

@ -28,11 +28,16 @@ angular.module('quay').directive('repositoryPermissionsTable', function () {
'repository': '=repository',
'isEnabled': '=isEnabled'
},
controller: function($scope, $element, ApiService, Restangular, UtilService) {
controller: function($scope, $element, ApiService, Restangular, UtilService, RolesService) {
$scope.permissionResources = {'team': {}, 'user': {}};
$scope.permissionCache = {};
$scope.permissions = {};
$scope.addPermissionInfo = {};
var readRole = RolesService.repoRoles[0].id;
$scope.addPermissionInfo = {
'role': readRole
};
var loadAllPermissions = function() {
if (!$scope.repository || !$scope.isEnabled) { return; }
@ -160,13 +165,17 @@ angular.module('quay').directive('repositoryPermissionsTable', function () {
var errorHandler = ApiService.errorDisplay('Cannot change permission', function() {
opt_callback && opt_callback(false);
$scope.addPermissionInfo = {};
$scope.addPermissionInfo = {
'role': readRole
};
});
var endpoint = getPermissionEndpoint(entityName, kind);
endpoint.customPUT(permission).then(function(result) {
$scope.permissions[kind][entityName] = result;
$scope.addPermissionInfo = {};
$scope.addPermissionInfo = {
'role': readRole
};
opt_callback && opt_callback(true)
}, errorHandler);
};