Default to the read role in the permissions table

Fixes #126
This commit is contained in:
Joseph Schorr 2015-06-15 16:11:39 -04:00
parent ae779cade2
commit 34ab6e4ccc

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);
};