1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Disable license buttons for non-superuser users

This commit is contained in:
Michael Abashian 2017-07-20 12:14:55 -04:00
parent 44a15b4dd2
commit ab4bc71d05
2 changed files with 7 additions and 5 deletions

View File

@ -73,7 +73,9 @@ export default
// HTML5 spec doesn't provide a way to customize file input css
// So we hide the default input, show our own, and simulate clicks to the hidden input
$scope.fakeClick = function(){
if($scope.user_is_superuser) {
$('#License-file').click();
}
};
$scope.downloadLicense = function(){

View File

@ -101,7 +101,7 @@
<form id="License-form" name="uploadlicense">
<div class="License-subTitleText prepend-asterisk"> <translate>License File</translate></div>
<div class="input-group License-file--container">
<span class="btn btn-primary" ng-click="fakeClick()" translate>Browse</span>
<span class="btn btn-primary" ng-click="fakeClick()" ng-disabled="!user_is_superuser" translate>Browse</span>
<span class="License-fileName" ng-class="{'License-helperText' : fileName == 'No file selected.'}">{{fileName|translate}}</span>
<input id="License-file" class="form-control" type="file" file-on-change="getKey"/>
</div>
@ -112,13 +112,13 @@
<div class="form-group License-detailsGroup">
<div class="checkbox">
<label class="License-details--label">
<input type="checkbox" ng-model="newLicense.eula" required>
<input type="checkbox" ng-model="newLicense.eula" ng-disabled="!user_is_superuser" required>
<translate>I agree to the End User License Agreement</translate>
</label>
</div>
</div>
<div>
<button ng-click="submit()" class="btn btn-success pull-right" ng-disabled="newLicense.file.license_key == null || newLicense.eula == null" translate>Submit</button>
<button ng-click="submit()" class="btn btn-success pull-right" ng-disabled="newLicense.file.license_key == null || newLicense.eula == null || !user_is_superuser" translate>Submit</button>
<span ng-show="success == true" class="License-greenText License-submit--success pull-right" translate>Save successful!</span>
</div>
</form>