mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
fix for setup menu route resolve
This commit is contained in:
@@ -7,29 +7,38 @@ 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 () {
|
|
||||||
if($rootScope.current_user.related.admin_of_organizations){
|
return $rootScope.loginConfig.promise.then(function () {
|
||||||
$rootScope.orgAdmin = false;
|
if($rootScope.current_user.related.admin_of_organizations){
|
||||||
if ($rootScope.current_user.is_superuser) {
|
$rootScope.orgAdmin = false;
|
||||||
$rootScope.orgAdmin = true;
|
if ($rootScope.current_user.is_superuser) {
|
||||||
} else {
|
return true;
|
||||||
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
} else {
|
||||||
return Rest.get().then(function(data){
|
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
||||||
$rootScope.orgAdmin = (data.data.count) ? true : false;
|
return Rest.get().then(function(data){
|
||||||
})
|
if(data.data.count){
|
||||||
.catch(function (data, status) {
|
return true;
|
||||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
}
|
||||||
});
|
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{
|
||||||
else{
|
return false;
|
||||||
return;
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user