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 // 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 // So we hide the default input, show our own, and simulate clicks to the hidden input
$scope.fakeClick = function(){ $scope.fakeClick = function(){
$('#License-file').click(); if($scope.user_is_superuser) {
$('#License-file').click();
}
}; };
$scope.downloadLicense = function(){ $scope.downloadLicense = function(){

View File

@ -101,8 +101,8 @@
<form id="License-form" name="uploadlicense"> <form id="License-form" name="uploadlicense">
<div class="License-subTitleText prepend-asterisk"> <translate>License File</translate></div> <div class="License-subTitleText prepend-asterisk"> <translate>License File</translate></div>
<div class="input-group License-file--container"> <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> <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"/> <input id="License-file" class="form-control" type="file" file-on-change="getKey"/>
</div> </div>
<div class="License-subTitleText prepend-asterisk"> <translate>End User License Agreement</translate> <div class="License-subTitleText prepend-asterisk"> <translate>End User License Agreement</translate>
@ -112,13 +112,13 @@
<div class="form-group License-detailsGroup"> <div class="form-group License-detailsGroup">
<div class="checkbox"> <div class="checkbox">
<label class="License-details--label"> <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> <translate>I agree to the End User License Agreement</translate>
</label> </label>
</div> </div>
</div> </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> <span ng-show="success == true" class="License-greenText License-submit--success pull-right" translate>Save successful!</span>
</div> </div>
</form> </form>