GUAC-932: Add permissions list.

This commit is contained in:
Michael Jumper
2014-12-22 16:40:06 -08:00
parent fae8f16780
commit b8e335e3c7
16 changed files with 115 additions and 150 deletions

View File

@@ -25,7 +25,9 @@
<!-- Connection --> <!-- Connection -->
<div class="connection" ng-show="item.isConnection"> <div class="connection" ng-show="item.isConnection">
<ng-include src="connectionTemplate"/> <div class="caption">
<ng-include src="connectionTemplate"/>
</div>
</div> </div>
<!-- Connection group --> <!-- Connection group -->

View File

@@ -73,6 +73,10 @@ div.recent-connections .protocol {
vertical-align: middle; vertical-align: middle;
} }
.caption > * {
display: inline-block;
}
.caption .name { .caption .name {
margin-left: 0.25em; margin-left: 0.25em;
} }

View File

@@ -72,8 +72,8 @@ h2 ~ h2 {
} }
div.section { div.section {
margin: 0; margin: 1em;
padding: 1em; padding: 0;
} }
/* /*

View File

@@ -55,7 +55,7 @@ angular.module('manage').controller('manageController', ['$scope', '$injector',
*/ */
$scope.newUsername = ""; $scope.newUsername = "";
// Retrieve all users for whom we have UPDATE permission // Retrieve all connections for which we have UPDATE permission
connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER, PermissionSet.ObjectPermissionType.UPDATE) connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER, PermissionSet.ObjectPermissionType.UPDATE)
.success(function connectionGroupReceived(rootGroup) { .success(function connectionGroupReceived(rootGroup) {
$scope.rootGroup = rootGroup; $scope.rootGroup = rootGroup;

View File

@@ -26,11 +26,16 @@
angular.module('manage').controller('manageUserController', ['$scope', '$injector', angular.module('manage').controller('manageUserController', ['$scope', '$injector',
function manageUserController($scope, $injector) { function manageUserController($scope, $injector) {
// Required types
var ConnectionGroup = $injector.get('ConnectionGroup');
var PermissionSet = $injector.get('PermissionSet');
// Required services // Required services
var $location = $injector.get('$location'); var $location = $injector.get('$location');
var $routeParams = $injector.get('$routeParams'); var $routeParams = $injector.get('$routeParams');
var userService = $injector.get('userService'); var connectionGroupService = $injector.get('connectionGroupService');
var permissionService = $injector.get('permissionService'); var userService = $injector.get('userService');
var permissionService = $injector.get('permissionService');
/** /**
* An action to be provided along with the object sent to showStatus which * An action to be provided along with the object sent to showStatus which
@@ -61,7 +66,13 @@ angular.module('manage').controller('manageUserController', ['$scope', '$injecto
$scope.permissions = permissions; $scope.permissions = permissions;
}); });
/** // Retrieve all connections for which we have UPDATE permission
connectionGroupService.getConnectionGroupTree(ConnectionGroup.ROOT_IDENTIFIER, PermissionSet.ObjectPermissionType.ADMINISTER)
.success(function connectionGroupReceived(rootGroup) {
$scope.rootGroup = rootGroup;
});
/**
* Cancels all pending edits, returning to the management page. * Cancels all pending edits, returning to the management page.
*/ */
$scope.cancel = function cancel() { $scope.cancel = function cancel() {

View File

@@ -1,35 +0,0 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* A modal for editing a connection group.
*/
angular.module('manage').factory('connectionGroupEditModal', ['btfModal',
function connectionGroupEditModal(btfModal) {
// Create the modal object to be used later to actually create the modal
return btfModal({
controller: 'connectionGroupEditModalController',
controllerAs: 'modal',
templateUrl: 'app/manage/templates/editableConnectionGroup.html',
});
}]);

View File

@@ -1,35 +0,0 @@
/*
* Copyright (C) 2014 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* A modal for editing a connection.
*/
angular.module('manage').factory('userEditModal', ['btfModal',
function userEditModal(btfModal) {
// Create the modal object to be used later to actually create the modal
return btfModal({
controller: 'userEditModalController',
controllerAs: 'modal',
templateUrl: 'app/manage/templates/editableUser.html',
});
}]);

View File

@@ -20,11 +20,7 @@
* THE SOFTWARE. * THE SOFTWARE.
*/ */
.manage .properties table { .manage table.properties th {
margin: 1em;
}
.manage .properties table th {
text-align: left; text-align: left;
font-weight: normal; font-weight: normal;
padding-right: 1em; padding-right: 1em;

View File

@@ -21,15 +21,12 @@
THE SOFTWARE. THE SOFTWARE.
--> -->
<div class="caption"> <!-- Connection icon -->
<div class="protocol">
<!-- Connection icon --> <div class="icon type" ng-class="item.protocol"></div>
<div class="protocol">
<div class="icon type" ng-class="item.protocol"></div>
</div>
<!-- Connection name -->
<span class="name">{{item.name}}</span>
</div> </div>
<!-- Connection name -->
<span class="name">{{item.name}}</span>
</a> </a>

View File

@@ -21,5 +21,5 @@
THE SOFTWARE. THE SOFTWARE.
--> -->
{{item.name}} <span class="name">{{item.name}}</span>
</a> </a>

View File

@@ -0,0 +1,26 @@
<div class="choice">
<!--
Copyright (C) 2014 Glyptodon LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<input type="checkbox" ng-model="connectionPermissions[item.identifier]" ng-change="markConnectionPermissionModified(item.identifier)"/>
<span class="name">{{item.name}}</span>
</div>

View File

@@ -0,0 +1,35 @@
<div class="choice">
<!--
Copyright (C) 2014 Glyptodon LLC
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<!-- Connection icon -->
<div class="protocol">
<div class="icon type" ng-class="item.protocol"></div>
</div>
<!-- Checkbox -->
<input type="checkbox" ng-model="connectionPermissions[item.identifier]" ng-change="markConnectionPermissionModified(item.identifier)"/>
<!-- Connection name -->
<span class="name">{{item.name}}</span>
</div>

View File

@@ -27,8 +27,8 @@ THE SOFTWARE.
<!-- Main property editor --> <!-- Main property editor -->
<h2>{{'manage.edit.connection.title' | translate}}</h2> <h2>{{'manage.edit.connection.title' | translate}}</h2>
<div class="properties"> <div class="section">
<table> <table class="properties">
<!-- Edit connection name --> <!-- Edit connection name -->
<tr> <tr>
@@ -59,8 +59,8 @@ THE SOFTWARE.
<!-- Connection parameters --> <!-- Connection parameters -->
<h2>{{'manage.edit.connection.parameters' | translate}}</h2> <h2>{{'manage.edit.connection.parameters' | translate}}</h2>
<div class="properties" ng-class="{loading: !parameters}"> <div class="section" ng-class="{loading: !parameters}">
<table class="fields"> <table class="properties">
<!-- All the different possible editable field types --> <!-- All the different possible editable field types -->
<tr ng-repeat="parameter in protocols[connection.protocol].parameters"> <tr ng-repeat="parameter in protocols[connection.protocol].parameters">
@@ -81,7 +81,7 @@ THE SOFTWARE.
<!-- Connection history --> <!-- Connection history -->
<h2>{{'manage.edit.connection.history.usageHistory' | translate}}</h2> <h2>{{'manage.edit.connection.history.usageHistory' | translate}}</h2>
<div class="history" ng-class="{loading: !historyEntryWrappers}"> <div class="history section" ng-class="{loading: !historyEntryWrappers}">
<p ng-hide="historyEntryWrappers.length">{{'manage.edit.connection.history.connectionNotUsed' | translate}}</p> <p ng-hide="historyEntryWrappers.length">{{'manage.edit.connection.history.connectionNotUsed' | translate}}</p>
<table ng-show="historyEntryWrappers.length"> <table ng-show="historyEntryWrappers.length">
<thead> <thead>

View File

@@ -27,8 +27,8 @@ THE SOFTWARE.
<!-- Main property editor --> <!-- Main property editor -->
<h2>{{'manage.edit.connectionGroup.title' | translate}}</h2> <h2>{{'manage.edit.connectionGroup.title' | translate}}</h2>
<div class="properties"> <div class="section">
<table> <table class="properties">
<!-- Edit connection group name --> <!-- Edit connection group name -->
<tr> <tr>

View File

@@ -20,41 +20,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
--> -->
<!-- Hierarchical connection and connection group permission selector -->
<script type="text/ng-template" id="nestedUserPermissionEditGroup.html">
<!-- Connection -->
<div class="choice" ng-show="item.isConnection">
<input type="checkbox" ng-model="connectionPermissions[item.identifier]" ng-change="markConnectionPermissionModified(item.identifier)"/>
<div class="connection list-item">
<div class="caption">
<div class="protocol">
<div class="icon" ng-class="item.protocol"></div>
</div><span class="name">{{item.name}}</span>
</div>
</div>
</div>
<!-- Connection group -->
<div class="choice" ng-show="!item.isConnection">
<input type="checkbox" ng-model="connectionGroupPermissions[item.identifier]" ng-change="markConnectionGroupPermissionModified(item.identifier)"/>
<div class="group empty list-item balancer">
<div class="caption">
<div class="icon group" ng-click="toggleExpanded(item)" ng-class="{expanded: item.expanded, empty: !item.children.length, balancer: item.balancer && !item.children.length}"></div>
<span class="name">{{item.name}}</span>
</div>
<!-- Connection group children -->
<div class="children" ng-show="item.expanded">
<div ng-repeat="item in item.children | orderBy : 'name'" ng-include="'nestedUserPermissionEditGroup.html'">
</div>
</div>
</div>
</script>
<div class="logout-panel"> <div class="logout-panel">
<a class="back button" href="#/manage/">{{'manage.back' | translate}}</a> <a class="back button" href="#/manage/">{{'manage.back' | translate}}</a>
<a class="logout button" ng-click="logout()">{{'home.logout' | translate}}</a> <a class="logout button" ng-click="logout()">{{'home.logout' | translate}}</a>
@@ -62,8 +27,8 @@ THE SOFTWARE.
<!-- Main property editor --> <!-- Main property editor -->
<h2>{{'manage.edit.user.title' | translate}}</h2> <h2>{{'manage.edit.user.title' | translate}}</h2>
<div class="properties"> <div class="section">
<table> <table class="properties">
<tr> <tr>
<th>{{'manage.edit.user.username' | translate}}</th> <th>{{'manage.edit.user.username' | translate}}</th>
@@ -84,8 +49,8 @@ THE SOFTWARE.
<!-- System permissions section --> <!-- System permissions section -->
<h2>{{'manage.edit.user.permissions' | translate}}</h2> <h2>{{'manage.edit.user.permissions' | translate}}</h2>
<div class="properties"> <div class="section">
<table> <table class="properties">
<tr> <tr>
<th>{{'manage.edit.user.administerSystem' | translate}}</th> <th>{{'manage.edit.user.administerSystem' | translate}}</th>
@@ -114,12 +79,12 @@ THE SOFTWARE.
<!-- Connection and connection group permission section --> <!-- Connection and connection group permission section -->
<h2>{{'manage.edit.user.connections' | translate}}</h2> <h2>{{'manage.edit.user.connections' | translate}}</h2>
<div> <div class="section" ng-class="{loading: !rootGroup}">
<div class="group-view"> <guac-group-list
<div class="list"> context="groupListContext"
<div ng-repeat="item in rootGroup.children | orderBy : 'name'" ng-include="'nestedUserPermissionEditGroup.html'"></div> connection-group="rootGroup"
</div> connection-template="'app/manage/templates/connectionPermission.html'"
</div> connection-group-template="'app/manage/templates/connectionGroupPermission.html'"/>
</div> </div>
<!-- Form action buttons --> <!-- Form action buttons -->

View File

@@ -91,17 +91,16 @@
"title" : "Delete User", "title" : "Delete User",
"text" : "Users cannot be restored after they have been deleted. Are you sure you want to delete this user?" "text" : "Users cannot be restored after they have been deleted. Are you sure you want to delete this user?"
}, },
"properties" : "Properties:",
"password" : "Password:", "password" : "Password:",
"passwordMatch" : "Re-enter Password:", "passwordMatch" : "Re-enter Password:",
"passwordMismatch" : "The provided passwords do not match.", "passwordMismatch" : "The provided passwords do not match.",
"permissions" : "Permissions:", "permissions" : "Permissions",
"username" : "Username:", "username" : "Username:",
"administerSystem" : "Administer system:", "administerSystem" : "Administer system:",
"createUser" : "Create new users:", "createUser" : "Create new users:",
"createConnection" : "Create new connections:", "createConnection" : "Create new connections:",
"createConnectionGroup" : "Create new connection groups:", "createConnectionGroup" : "Create new connection groups:",
"connections" : "Connections:" "connections" : "Connections"
} }
}, },
"error": { "error": {