mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 03:10:42 -03:30
fix for setup menu route resolve
This commit is contained in:
parent
8a34b5712a
commit
11bd5570cf
@ -7,29 +7,38 @@ export default {
|
||||
label: "SETTINGS"
|
||||
},
|
||||
templateUrl: templateUrl('setup-menu/setup-menu'),
|
||||
controller: function(orgAdmin, $scope){
|
||||
$scope.orgAdmin = orgAdmin;
|
||||
},
|
||||
resolve: {
|
||||
org_admin:
|
||||
orgAdmin:
|
||||
['$rootScope', 'ProcessErrors', 'Rest',
|
||||
function($rootScope, ProcessErrors, Rest){
|
||||
$rootScope.loginConfig.promise.then(function () {
|
||||
if($rootScope.current_user.related.admin_of_organizations){
|
||||
$rootScope.orgAdmin = false;
|
||||
if ($rootScope.current_user.is_superuser) {
|
||||
$rootScope.orgAdmin = true;
|
||||
} else {
|
||||
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
||||
return Rest.get().then(function(data){
|
||||
$rootScope.orgAdmin = (data.data.count) ? true : false;
|
||||
})
|
||||
.catch(function (data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
||||
});
|
||||
|
||||
return $rootScope.loginConfig.promise.then(function () {
|
||||
if($rootScope.current_user.related.admin_of_organizations){
|
||||
$rootScope.orgAdmin = false;
|
||||
if ($rootScope.current_user.is_superuser) {
|
||||
return true;
|
||||
} else {
|
||||
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
||||
return Rest.get().then(function(data){
|
||||
if(data.data.count){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.catch(function (data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
});
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user