mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUACAMOLE-292: Explicitly pull standard attributes when rendering user menu; do not rely on schema.
This commit is contained in:
@@ -43,11 +43,13 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
|
|||||||
controller: ['$scope', '$injector',
|
controller: ['$scope', '$injector',
|
||||||
function guacUserMenuController($scope, $injector) {
|
function guacUserMenuController($scope, $injector) {
|
||||||
|
|
||||||
|
// Required types
|
||||||
|
var User = $injector.get('User');
|
||||||
|
|
||||||
// Get required services
|
// Get required services
|
||||||
var $location = $injector.get('$location');
|
var $location = $injector.get('$location');
|
||||||
var $route = $injector.get('$route');
|
var $route = $injector.get('$route');
|
||||||
var authenticationService = $injector.get('authenticationService');
|
var authenticationService = $injector.get('authenticationService');
|
||||||
var schemaService = $injector.get('schemaService');
|
|
||||||
var userService = $injector.get('userService');
|
var userService = $injector.get('userService');
|
||||||
var userPageService = $injector.get('userPageService');
|
var userPageService = $injector.get('userPageService');
|
||||||
|
|
||||||
@@ -57,17 +59,57 @@ angular.module('navigation').directive('guacUserMenu', [function guacUserMenu()
|
|||||||
* @type String
|
* @type String
|
||||||
*/
|
*/
|
||||||
$scope.username = authenticationService.getCurrentUsername();
|
$scope.username = authenticationService.getCurrentUsername();
|
||||||
|
|
||||||
// Pull user attribute schema
|
/**
|
||||||
schemaService.getUserAttributes(authenticationService.getDataSource())
|
* The user's full name. If not yet available, or if not defined,
|
||||||
.success(function attributesReceived(attributes) {
|
* this will be null.
|
||||||
$scope.attributes = attributes;
|
*
|
||||||
});
|
* @type String
|
||||||
|
*/
|
||||||
|
$scope.fullName = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A URL pointing to relevant user information such as the user's
|
||||||
|
* email address. If not yet available, or if no such URL can be
|
||||||
|
* determined, this will be null.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
$scope.userURL = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The organization, company, group, etc. that the user belongs to.
|
||||||
|
* If not yet available, or if not defined, this will be null.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
$scope.organization = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The role that the user has at the organization, company, group,
|
||||||
|
* etc. they belong to. If not yet available, or if not defined,
|
||||||
|
* this will be null.
|
||||||
|
*
|
||||||
|
* @type String
|
||||||
|
*/
|
||||||
|
$scope.role = null;
|
||||||
|
|
||||||
// Pull user data
|
// Pull user data
|
||||||
userService.getUser(authenticationService.getDataSource(), $scope.username)
|
userService.getUser(authenticationService.getDataSource(), $scope.username)
|
||||||
.success(function userRetrieved(user) {
|
.success(function userRetrieved(user) {
|
||||||
|
|
||||||
|
// Store retrieved user object
|
||||||
$scope.user = user;
|
$scope.user = user;
|
||||||
|
|
||||||
|
// Pull basic profile information
|
||||||
|
$scope.fullName = user.attributes[User.Attributes.FULL_NAME];
|
||||||
|
$scope.organization = user.attributes[User.Attributes.ORGANIZATION];
|
||||||
|
$scope.role = user.attributes[User.Attributes.ORGANIZATIONAL_ROLE];
|
||||||
|
|
||||||
|
// Link to email address if available
|
||||||
|
var email = user.attributes[User.Attributes.EMAIL_ADDRESS];
|
||||||
|
$scope.userURL = email ? 'mailto:' + email : null;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -90,7 +90,10 @@
|
|||||||
width: 2in;
|
width: 2in;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-menu .menu-dropdown .menu-contents .profile span.field-header,
|
.user-menu .menu-dropdown .menu-contents .profile .full-name {
|
||||||
.user-menu .menu-dropdown .menu-contents .profile h3 {
|
font-weight: bold;
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
.user-menu .menu-dropdown .menu-contents .profile .organization,
|
||||||
|
.user-menu .menu-dropdown .menu-contents .profile .organizational-role {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
@@ -2,10 +2,10 @@
|
|||||||
<guac-menu menu-title="username">
|
<guac-menu menu-title="username">
|
||||||
|
|
||||||
<!-- User profile view -->
|
<!-- User profile view -->
|
||||||
<div class="profile">
|
<div class="profile" ng-show="fullName">
|
||||||
<guac-form namespace="'USER_ATTRIBUTES'" content="attributes"
|
<div class="full-name"><a ng-href="{{userURL}}">{{ fullName }}</a></div>
|
||||||
model="user.attributes" values-only="true"
|
<div class="organizational-role" ng-show="role">{{ role }}</div>
|
||||||
read-only="true"></guac-form>
|
<div class="organization" ng-show="organization">{{ organization }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Local actions -->
|
<!-- Local actions -->
|
||||||
|
Reference in New Issue
Block a user