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