- Fix namespace drop down to save the namespace last selected (and validate)
- Add a "can_create_repo" entry to the organization and have orgs grayed out in the new repo view if the user cannot create a repo - Fix the multiple-orgs bug in the model - Have the "create new repository" button disappear on landing if the org is selected and the user does not have create permissions for that org
This commit is contained in:
parent
4b460be4dd
commit
0c4dec6de4
10 changed files with 89 additions and 14 deletions
|
@ -230,6 +230,23 @@ function LandingCtrl($scope, $timeout, $location, Restangular, UserService, KeyS
|
|||
});
|
||||
};
|
||||
|
||||
$scope.canCreateRepo = function(namespace) {
|
||||
if (!$scope.user) { return false; }
|
||||
|
||||
if (namespace == $scope.user.username) {
|
||||
return true;
|
||||
}
|
||||
|
||||
for (var i = 0; i < $scope.user.organizations.length; ++i) {
|
||||
var org = $scope.user.organizations[i];
|
||||
if (org.name == namespace) {
|
||||
return org.can_create_repo;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var loadMyRepos = function(namespace) {
|
||||
if (!$scope.user || $scope.user.anonymous || !namespace) {
|
||||
return;
|
||||
|
|
Reference in a new issue