mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
hiding notifcation templates on setup menu
for non org admins
This commit is contained in:
parent
283b62e598
commit
3115dd4fee
@ -36,7 +36,8 @@
|
||||
Create and edit scripts to dynamically load hosts from any source.
|
||||
</p>
|
||||
</a>
|
||||
<a ui-sref="notifications" class="SetupItem">
|
||||
<a ui-sref="notifications" class="SetupItem"
|
||||
ng-if="orgAdmin">
|
||||
<h4 class="SetupItem-title">Notifications</h4>
|
||||
<p class="SetupItem-description">
|
||||
Create templates for sending notifications with Email, HipChat, Slack, and SMS.
|
||||
|
||||
@ -6,5 +6,30 @@ export default {
|
||||
ncyBreadcrumb: {
|
||||
label: "SETTINGS"
|
||||
},
|
||||
templateUrl: templateUrl('setup-menu/setup-menu')
|
||||
templateUrl: templateUrl('setup-menu/setup-menu'),
|
||||
resolve: {
|
||||
org_admin:
|
||||
['$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`);
|
||||
Rest.get()
|
||||
.success(function(data) {
|
||||
$rootScope.orgAdmin = (data.count) ? true : false;
|
||||
}).error(function (data, status) {
|
||||
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', msg: 'Failed to find if users is admin of org' + status });
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
return;
|
||||
}
|
||||
});
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user