mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-09 14:41:21 +00:00
GUAC-932: Send individual patch operations for permission types.
This commit is contained in:
@@ -105,6 +105,10 @@ angular.module('rest').factory('permissionService', ['$http', 'authenticationSer
|
|||||||
* The operation to specify within each of the patches. Valid values
|
* The operation to specify within each of the patches. Valid values
|
||||||
* for this are defined within PermissionPatch.Operation.
|
* for this are defined within PermissionPatch.Operation.
|
||||||
*
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* The path of the permissions being patched. The path is a JSON path
|
||||||
|
* describing the position of the permissions within a PermissionSet.
|
||||||
|
*
|
||||||
* @param {Object.<String, String[]>} permissions
|
* @param {Object.<String, String[]>} permissions
|
||||||
* A map of object identifiers to arrays of permission type strings,
|
* A map of object identifiers to arrays of permission type strings,
|
||||||
* where each type string is a value from
|
* where each type string is a value from
|
||||||
@@ -114,10 +118,12 @@ angular.module('rest').factory('permissionService', ['$http', 'authenticationSer
|
|||||||
|
|
||||||
// Add object permission operations to patch
|
// Add object permission operations to patch
|
||||||
for (var identifier in permissions) {
|
for (var identifier in permissions) {
|
||||||
patch.push({
|
permissions[identifier].forEach(function addObjectPatch(type) {
|
||||||
op : operation,
|
patch.push({
|
||||||
path : path + "/" + identifier,
|
op : operation,
|
||||||
value : permissions[identifier]
|
path : path + "/" + identifier,
|
||||||
|
value : type
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,13 +158,13 @@ angular.module('rest').factory('permissionService', ['$http', 'authenticationSer
|
|||||||
permissions.userPermissions);
|
permissions.userPermissions);
|
||||||
|
|
||||||
// Add system operations to patch
|
// Add system operations to patch
|
||||||
if (permissions.systemPermissions.length) {
|
permissions.systemPermissions.forEach(function addSystemPatch(type) {
|
||||||
patch.push({
|
patch.push({
|
||||||
op : operation,
|
op : operation,
|
||||||
path : "/systemPermissions",
|
path : "/systemPermissions",
|
||||||
value : permissions.systemPermissions
|
value : type
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -59,15 +59,15 @@ angular.module('rest').factory('PermissionPatch', [function definePermissionPatc
|
|||||||
this.path = template.path;
|
this.path = template.path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The array of permissions. If the permission applies to an object,
|
* The permissions being added or removed. If the permission applies to
|
||||||
* such as a connection or connection group, these will be values from
|
* an object, such as a connection or connection group, this will be a
|
||||||
* PermissionSet.ObjectPermissionType. If the permission applies to
|
* value from PermissionSet.ObjectPermissionType. If the permission
|
||||||
* the system as a whole (the path is "/systemPermissions"), these will
|
* applies to the system as a whole (the path is "/systemPermissions"),
|
||||||
* be values from PermissionSet.SystemPermissionType.
|
* this will be a value from PermissionSet.SystemPermissionType.
|
||||||
*
|
*
|
||||||
* @type String[]
|
* @type String
|
||||||
*/
|
*/
|
||||||
this.value = template.value || [];
|
this.value = template.value;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,12 +78,12 @@ angular.module('rest').factory('PermissionPatch', [function definePermissionPatc
|
|||||||
PermissionPatch.Operation = {
|
PermissionPatch.Operation = {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds (grants) the specified permissions.
|
* Adds (grants) the specified permission.
|
||||||
*/
|
*/
|
||||||
ADD : "add",
|
ADD : "add",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes (revokes) the specified permissions.
|
* Removes (revokes) the specified permission.
|
||||||
*/
|
*/
|
||||||
REMOVE : "remove"
|
REMOVE : "remove"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user