mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-5: Implement management interface for sharing profile permissions.
This commit is contained in:
@@ -165,7 +165,8 @@ div.section {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.connection .icon,
|
.connection .icon,
|
||||||
.connection-group .icon {
|
.connection-group .icon,
|
||||||
|
.sharing-profile .icon {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
@@ -199,6 +200,10 @@ div.section {
|
|||||||
background-image: url('images/protocol-icons/guac-monitor.png');
|
background-image: url('images/protocol-icons/guac-monitor.png');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sharing-profile .icon {
|
||||||
|
background-image: url('images/share.png');
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Groups
|
* Groups
|
||||||
*/
|
*/
|
||||||
|
@@ -633,6 +633,10 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
{
|
{
|
||||||
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS",
|
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS",
|
||||||
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION_GROUP
|
value: PermissionSet.SystemPermissionType.CREATE_CONNECTION_GROUP
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "MANAGE_USER.FIELD_HEADER_CREATE_NEW_SHARING_PROFILES",
|
||||||
|
value: PermissionSet.SystemPermissionType.CREATE_SHARING_PROFILE
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -861,6 +865,45 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the permissionsAdded and permissionsRemoved permission sets to
|
||||||
|
* reflect the addition of the given sharing profile permission.
|
||||||
|
*
|
||||||
|
* @param {String} identifier
|
||||||
|
* The identifier of the sharing profile to add READ permission for.
|
||||||
|
*/
|
||||||
|
var addSharingProfilePermission = function addSharingProfilePermission(identifier) {
|
||||||
|
|
||||||
|
// If permission was previously removed, simply un-remove it
|
||||||
|
if (PermissionSet.hasSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier))
|
||||||
|
PermissionSet.removeSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier);
|
||||||
|
|
||||||
|
// Otherwise, explicitly add the permission
|
||||||
|
else
|
||||||
|
PermissionSet.addSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the permissionsAdded and permissionsRemoved permission sets to
|
||||||
|
* reflect the removal of the given sharing profile permission.
|
||||||
|
*
|
||||||
|
* @param {String} identifier
|
||||||
|
* The identifier of the sharing profile to remove READ permission for.
|
||||||
|
*/
|
||||||
|
var removeSharingProfilePermission = function removeSharingProfilePermission(identifier) {
|
||||||
|
|
||||||
|
// If permission was previously added, simply un-add it
|
||||||
|
if (PermissionSet.hasSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier))
|
||||||
|
PermissionSet.removeSharingProfilePermission(permissionsAdded, PermissionSet.ObjectPermissionType.READ, identifier);
|
||||||
|
|
||||||
|
// Otherwise, explicitly remove the permission
|
||||||
|
else
|
||||||
|
PermissionSet.addSharingProfilePermission(permissionsRemoved, PermissionSet.ObjectPermissionType.READ, identifier);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Expose permission query and modification functions to group list template
|
// Expose permission query and modification functions to group list template
|
||||||
$scope.groupListContext = {
|
$scope.groupListContext = {
|
||||||
|
|
||||||
@@ -918,6 +961,28 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
|
|||||||
else
|
else
|
||||||
removeConnectionGroupPermission(identifier);
|
removeConnectionGroupPermission(identifier);
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notifies the controller that a change has been made to the given
|
||||||
|
* sharing profile permission for the user being edited. This only
|
||||||
|
* applies to READ permissions.
|
||||||
|
*
|
||||||
|
* @param {String} identifier
|
||||||
|
* The identifier of the sharing profile affected by the changed
|
||||||
|
* permission.
|
||||||
|
*/
|
||||||
|
sharingProfilePermissionChanged : function sharingProfilePermissionChanged(identifier) {
|
||||||
|
|
||||||
|
// Determine current permission setting
|
||||||
|
var value = $scope.permissionFlags.sharingProfilePermissions.READ[identifier];
|
||||||
|
|
||||||
|
// Add/remove permission depending on flag state
|
||||||
|
if (value)
|
||||||
|
addSharingProfilePermission(identifier);
|
||||||
|
else
|
||||||
|
removeSharingProfilePermission(identifier);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -79,6 +79,7 @@
|
|||||||
context="groupListContext"
|
context="groupListContext"
|
||||||
connection-groups="filteredRootGroups"
|
connection-groups="filteredRootGroups"
|
||||||
connection-template="'app/manage/templates/connectionPermission.html'"
|
connection-template="'app/manage/templates/connectionPermission.html'"
|
||||||
|
sharing-profile-template="'app/manage/templates/sharingProfilePermission.html'"
|
||||||
connection-group-template="'app/manage/templates/connectionGroupPermission.html'"
|
connection-group-template="'app/manage/templates/connectionGroupPermission.html'"
|
||||||
page-size="20"/>
|
page-size="20"/>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
<div class="choice">
|
||||||
|
|
||||||
|
<!-- Sharing profile icon -->
|
||||||
|
<div class="icon type"></div>
|
||||||
|
|
||||||
|
<!-- Permission checkbox -->
|
||||||
|
<input type="checkbox" ng-model="context.getPermissionFlags().sharingProfilePermissions.READ[item.identifier]"
|
||||||
|
ng-change="context.sharingProfilePermissionChanged(item.identifier)"/>
|
||||||
|
|
||||||
|
<!-- Sharing profile name -->
|
||||||
|
<span class="name">{{item.name}}</span>
|
||||||
|
|
||||||
|
</div>
|
@@ -256,6 +256,7 @@
|
|||||||
"FIELD_HEADER_CREATE_NEW_USERS" : "Create new users:",
|
"FIELD_HEADER_CREATE_NEW_USERS" : "Create new users:",
|
||||||
"FIELD_HEADER_CREATE_NEW_CONNECTIONS" : "Create new connections:",
|
"FIELD_HEADER_CREATE_NEW_CONNECTIONS" : "Create new connections:",
|
||||||
"FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS" : "Create new connection groups:",
|
"FIELD_HEADER_CREATE_NEW_CONNECTION_GROUPS" : "Create new connection groups:",
|
||||||
|
"FIELD_HEADER_CREATE_NEW_SHARING_PROFILES" : "Create new sharing profiles:",
|
||||||
"FIELD_HEADER_PASSWORD" : "@:APP.FIELD_HEADER_PASSWORD",
|
"FIELD_HEADER_PASSWORD" : "@:APP.FIELD_HEADER_PASSWORD",
|
||||||
"FIELD_HEADER_PASSWORD_AGAIN" : "@:APP.FIELD_HEADER_PASSWORD_AGAIN",
|
"FIELD_HEADER_PASSWORD_AGAIN" : "@:APP.FIELD_HEADER_PASSWORD_AGAIN",
|
||||||
"FIELD_HEADER_USERNAME" : "Username:",
|
"FIELD_HEADER_USERNAME" : "Username:",
|
||||||
|
Reference in New Issue
Block a user