mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-1656: Fix user preferences permissioning.
This commit is contained in:
		| @@ -143,12 +143,13 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe | ||||
|             $scope.newPasswordMatch = null; | ||||
|  | ||||
|             /** | ||||
|              * Whether the current user can change their own password, or null | ||||
|              * if this is not yet known. | ||||
|              * Whether the current user can edit themselves - i.e. update their | ||||
|              * password or change user preference attributes, or null if this | ||||
|              * is not yet known. | ||||
|              * | ||||
|              * @type Boolean | ||||
|              */ | ||||
|             $scope.canChangePassword = null; | ||||
|             $scope.canUpdateSelf = null; | ||||
|  | ||||
|             /** | ||||
|              * Update the current user's password to the password currently set within | ||||
| @@ -206,13 +207,13 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe | ||||
|             permissionService.getEffectivePermissions(dataSource, username) | ||||
|             .then(function permissionsRetrieved(permissions) { | ||||
|  | ||||
|                 // Add action for changing password if permission is granted | ||||
|                 $scope.canChangePassword = PermissionSet.hasUserPermission(permissions, | ||||
|                 // Add action for updaing password or user preferences if permission is granted | ||||
|                 $scope.canUpdateSelf = PermissionSet.hasUserPermission(permissions, | ||||
|                         PermissionSet.ObjectPermissionType.UPDATE, username); | ||||
|                          | ||||
|             }) | ||||
|             ['catch'](requestService.createErrorCallback(function permissionsFailed(error) { | ||||
|                 $scope.canChangePassword = false; | ||||
|                 $scope.canUpdateSelf = false; | ||||
|             })); | ||||
|  | ||||
|             /** | ||||
| @@ -224,8 +225,8 @@ angular.module('settings').directive('guacSettingsPreferences', [function guacSe | ||||
|              */ | ||||
|             $scope.isLoaded = function isLoaded() { | ||||
|  | ||||
|                 return $scope.canChangePassword !== null | ||||
|                     && $scope.languages         !== null; | ||||
|                 return $scope.canUpdateSelf !== null | ||||
|                     && $scope.languages     !== null; | ||||
|  | ||||
|             }; | ||||
|  | ||||
|   | ||||
| @@ -7,8 +7,8 @@ | ||||
|     </div> | ||||
|      | ||||
|     <!-- Password update --> | ||||
|     <h2 class="header" ng-show="canChangePassword">{{'SETTINGS_PREFERENCES.SECTION_HEADER_UPDATE_PASSWORD' | translate}}</h2> | ||||
|     <div class="settings section update-password" ng-show="canChangePassword"> | ||||
|     <h2 class="header" ng-show="canUpdateSelf">{{'SETTINGS_PREFERENCES.SECTION_HEADER_UPDATE_PASSWORD' | translate}}</h2> | ||||
|     <div class="settings section update-password" ng-show="canUpdateSelf"> | ||||
|         <p>{{'SETTINGS_PREFERENCES.HELP_UPDATE_PASSWORD' | translate}}</p> | ||||
|  | ||||
|         <!-- Password editor --> | ||||
| @@ -90,7 +90,7 @@ | ||||
|     </div> | ||||
|  | ||||
|     <!-- User attributes section --> | ||||
|     <div class="attributes" ng-show="attributes.length"> | ||||
|     <div class="attributes" ng-show="canUpdateSelf && attributes.length"> | ||||
|         <guac-form namespace="'USER_ATTRIBUTES'" content="attributes" | ||||
|                    model="user.attributes"></guac-form> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user