mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
This commit is contained in:
@@ -178,32 +178,39 @@ export function CredentialsAdd($scope, $rootScope, $compile, $location, $log,
|
|||||||
|
|
||||||
$scope.canShareCredential = false;
|
$scope.canShareCredential = false;
|
||||||
|
|
||||||
if ($rootScope.current_user.is_superuser) {
|
$rootScope.$watch('current_user', function(){
|
||||||
$scope.canShareCredential = true;
|
try {
|
||||||
} else {
|
if ($rootScope.current_user.is_superuser) {
|
||||||
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
$scope.canShareCredential = true;
|
||||||
Rest.get()
|
} else {
|
||||||
.success(function(data) {
|
Rest.setUrl(`/api/v1/users/${$rootScope.current_user.id}/admin_of_organizations`);
|
||||||
$scope.canShareCredential = (data.count) ? true : false;
|
Rest.get()
|
||||||
}).error(function (data, status) {
|
.success(function(data) {
|
||||||
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
$scope.canShareCredential = (data.count) ? true : false;
|
||||||
|
}).error(function (data, status) {
|
||||||
|
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var orgUrl = ($rootScope.current_user.is_superuser) ?
|
||||||
|
GetBasePath("organizations") :
|
||||||
|
$rootScope.current_user.url + "admin_of_organizations?";
|
||||||
|
|
||||||
|
// Create LookUpInit for organizations
|
||||||
|
LookUpInit({
|
||||||
|
scope: $scope,
|
||||||
|
url: orgUrl,
|
||||||
|
form: form,
|
||||||
|
list: OrganizationList,
|
||||||
|
field: 'organization',
|
||||||
|
input_type: 'radio',
|
||||||
|
autopopulateLookup: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
catch(err){
|
||||||
|
// $rootScope.current_user isn't available because a call to the config endpoint hasn't finished resolving yet
|
||||||
var orgUrl = ($rootScope.current_user.is_superuser) ?
|
}
|
||||||
GetBasePath("organizations") :
|
|
||||||
$rootScope.current_user.url + "admin_of_organizations?";
|
|
||||||
|
|
||||||
// Create LookUpInit for organizations
|
|
||||||
LookUpInit({
|
|
||||||
scope: $scope,
|
|
||||||
url: orgUrl,
|
|
||||||
form: form,
|
|
||||||
list: OrganizationList,
|
|
||||||
field: 'organization',
|
|
||||||
input_type: 'radio',
|
|
||||||
autopopulateLookup: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!Empty($stateParams.user_id)) {
|
if (!Empty($stateParams.user_id)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user