mirror of
https://github.com/ansible/awx.git
synced 2026-02-14 09:44:47 -03:30
permission tab disable for private credentials
This commit is contained in:
@@ -283,7 +283,7 @@ CredentialsAdd.$inject = ['$scope', '$rootScope', '$compile', '$location',
|
|||||||
export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
||||||
$stateParams, CredentialForm, Rest, Alert, ProcessErrors, ClearScope, Prompt,
|
$stateParams, CredentialForm, Rest, Alert, ProcessErrors, ClearScope, Prompt,
|
||||||
GetBasePath, GetChoices, KindChange, Empty, OwnerChange, FormSave, Wait,
|
GetBasePath, GetChoices, KindChange, Empty, OwnerChange, FormSave, Wait,
|
||||||
$state, CreateSelect2, Authorization) {
|
$state, CreateSelect2, Authorization, i18n) {
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
|
|
||||||
@@ -336,13 +336,14 @@ export function CredentialsEdit($scope, $rootScope, $compile, $location, $log,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the credential is assigned to an organization, allow permission delegation
|
$scope.$watch('organization', function(val) {
|
||||||
// do NOT use $scope.organization in a view directive to determine if a credential is associated with an org
|
if (val === undefined) {
|
||||||
// @todo why not? ^ and what is this type check for a number doing - should this be a type check for undefined?
|
$scope.permissionsTooltip = i18n._('Credentials are only shared within an organization. Assign credentials to an organization to delegate credential permissions. The organization cannot be edited after credentials are assigned.');
|
||||||
$scope.disablePermissionAssignment = typeof($scope.organization) === 'number' ? false : true;
|
} else {
|
||||||
if ($scope.disablePermissionAssignment) {
|
$scope.permissionsTooltip = '';
|
||||||
$scope.permissionsTooltip = 'Credentials are only shared within an organization. Assign credentials to an organization to delegate credential permissions. The organization cannot be edited after credentials are assigned.';
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
setAskCheckboxes();
|
setAskCheckboxes();
|
||||||
KindChange({
|
KindChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
@@ -613,5 +614,5 @@ CredentialsEdit.$inject = ['$scope', '$rootScope', '$compile', '$location',
|
|||||||
'$log', '$stateParams', 'CredentialForm', 'Rest', 'Alert',
|
'$log', '$stateParams', 'CredentialForm', 'Rest', 'Alert',
|
||||||
'ProcessErrors', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices',
|
'ProcessErrors', 'ClearScope', 'Prompt', 'GetBasePath', 'GetChoices',
|
||||||
'KindChange', 'Empty', 'OwnerChange',
|
'KindChange', 'Empty', 'OwnerChange',
|
||||||
'FormSave', 'Wait', '$state', 'CreateSelect2', 'Authorization'
|
'FormSave', 'Wait', '$state', 'CreateSelect2', 'Authorization', 'i18n',
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -420,7 +420,9 @@ export default
|
|||||||
|
|
||||||
related: {
|
related: {
|
||||||
permissions: {
|
permissions: {
|
||||||
disabled: 'disablePermissionAssignment',
|
disabled: '(organization === undefined ? true : false)',
|
||||||
|
// Do not transition the state if organization is undefined
|
||||||
|
ngClick: `(organization === undefined ? true : false)||$state.go('credentials.edit.permissions')`,
|
||||||
awToolTip: '{{permissionsTooltip}}',
|
awToolTip: '{{permissionsTooltip}}',
|
||||||
dataTipWatch: 'permissionsTooltip',
|
dataTipWatch: 'permissionsTooltip',
|
||||||
dataPlacement: 'top',
|
dataPlacement: 'top',
|
||||||
|
|||||||
@@ -621,11 +621,9 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
|
|||||||
if (attrs.tipWatch) {
|
if (attrs.tipWatch) {
|
||||||
// Add dataTipWatch: 'variable_name'
|
// Add dataTipWatch: 'variable_name'
|
||||||
scope.$watch(attrs.tipWatch, function(newVal, oldVal) {
|
scope.$watch(attrs.tipWatch, function(newVal, oldVal) {
|
||||||
if (newVal !== oldVal) {
|
// Where did fixTitle come from?:
|
||||||
// Where did fixTitle come from?:
|
// http://stackoverflow.com/questions/9501921/change-twitter-bootstrap-tooltip-content-on-click
|
||||||
// http://stackoverflow.com/questions/9501921/change-twitter-bootstrap-tooltip-content-on-click
|
$(element).tooltip('hide').attr('data-original-title', newVal).tooltip('fixTitle');
|
||||||
$(element).tooltip('hide').attr('data-original-title', newVal).tooltip('fixTitle');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user