Updatd realm and application forms

This commit is contained in:
Stian Thorgersen 2013-07-25 12:40:26 +01:00
parent 3cbcc8c324
commit 4952849526
13 changed files with 665 additions and 498 deletions

View file

@ -24,27 +24,27 @@ import javax.ws.rs.core.Response;
@Path("")
public class Admin extends javax.ws.rs.core.Application {
private static Map<String, Realm> realms = new HashMap<String, Realm>();
private static Map<String, Application> applications = new HashMap<String, Application>();
private static Map<String, Realm> realms = new HashMap<String, Realm>();
@DELETE
@Path("/applications/{key}")
public void delete(@PathParam("key") String applicationKey) {
applications.remove(applicationKey);
@Path("/applications/{id}")
public void delete(@PathParam("id") String id) {
applications.remove(id);
}
@DELETE
@Path("/realms/{key}")
public void deleteRealm(@PathParam("key") String key) {
realms.remove(key);
@Path("/realms/{id}")
public void deleteRealm(@PathParam("id") String id) {
realms.remove(id);
}
@GET
@Path("/applications/{key}")
@Path("/applications/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Application getApplication(@PathParam("key") String applicationKey) {
return applications.get(applicationKey);
public Application getApplication(@PathParam("id") String id) {
return applications.get(id);
}
@GET
@ -55,10 +55,10 @@ public class Admin extends javax.ws.rs.core.Application {
}
@GET
@Path("/realms/{key}")
@Path("/realms/{id}")
@Produces(MediaType.APPLICATION_JSON)
public Realm getRealm(@PathParam("key") String key) {
return realms.get(key);
public Realm getRealm(@PathParam("id") String id) {
return realms.get(id);
}
@ -73,33 +73,33 @@ public class Admin extends javax.ws.rs.core.Application {
@Path("/applications")
@Consumes(MediaType.APPLICATION_JSON)
public Response save(Application application) {
String key = UUID.randomUUID().toString();
application.setKey(key);
applications.put(key, application);
return Response.created(URI.create("/applications/" + application.getKey())).build();
String id = UUID.randomUUID().toString();
application.setId(id);
applications.put(id, application);
return Response.created(URI.create("/applications/" + id)).build();
}
@POST
@Path("/realms")
@Consumes(MediaType.APPLICATION_JSON)
public Response save(Realm realm) {
String key = UUID.randomUUID().toString();
realm.setKey(key);
realms.put(key, realm);
return Response.created(URI.create("/realms/" + realm.getKey())).build();
String id = UUID.randomUUID().toString();
realm.setId(id);
realms.put(id, realm);
return Response.created(URI.create("/realms/" + id)).build();
}
@PUT
@Path("/applications/{key}")
@Path("/applications/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public void save(@PathParam("key") String applicationKey, Application application) {
applications.put(applicationKey, application);
public void save(@PathParam("id") String id, Application application) {
applications.put(id, application);
}
@PUT
@Path("/realms/{key}")
@Path("/realms/{id}")
@Consumes(MediaType.APPLICATION_JSON)
public void save(@PathParam("key") String key, Realm realm) {
realms.put(key, realm);
public void save(@PathParam("id") String id, Realm realm) {
realms.put(id, realm);
}
}

View file

@ -21,8 +21,6 @@
*/
package org.keycloak.ui.example;
import java.util.List;
import javax.xml.bind.annotation.XmlRootElement;
/**
@ -31,84 +29,74 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Application {
private String callbackUrl;
private String[] callbackUrl;
private String key;
private boolean enabled;
private String id;
private String[] initialRoles;
private String name;
private String owner;
private String javaScriptOrigin;
private List<IdentityProviderConfig> providers;
private String secret;
private String realm;
public String getCallbackUrl() {
private String[] roles;
public String[] getCallbackUrl() {
return callbackUrl;
}
public String getJavaScriptOrigin() {
return javaScriptOrigin;
public String getId() {
return id;
}
public String getKey() {
return key;
public String[] getInitialRoles() {
return initialRoles;
}
public String getName() {
return name;
}
public String getOwner() {
return owner;
}
public List<IdentityProviderConfig> getProviders() {
return providers;
}
public String getSecret() {
return secret;
}
public String getRealm() {
return realm;
}
public void setCallbackUrl(String callbackUrl) {
public String[] getRoles() {
return roles;
}
public boolean isEnabled() {
return enabled;
}
public void setCallbackUrl(String[] callbackUrl) {
this.callbackUrl = callbackUrl;
}
public void setJavaScriptOrigin(String javaScriptOrigin) {
this.javaScriptOrigin = javaScriptOrigin;
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setKey(String key) {
this.key = key;
public void setId(String id) {
this.id = id;
}
public void setInitialRoles(String[] initialRoles) {
this.initialRoles = initialRoles;
}
public void setName(String name) {
this.name = name;
}
public void setOwner(String owner) {
this.owner = owner;
}
public void setProviders(List<IdentityProviderConfig> providers) {
this.providers = providers;
}
public void setSecret(String secret) {
this.secret = secret;
}
public void setRealm(String realm) {
this.realm = realm;
}
public void setRoles(String[] roles) {
this.roles = roles;
}
}

View file

@ -21,40 +21,101 @@
*/
package org.keycloak.ui.example;
import java.util.concurrent.TimeUnit;
/**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
*/
public class Realm {
private String key;
private boolean enabled;
private String[] initialRoles;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
private String name;
private String owner;
private String[] roles;
public String getKey() {
return key;
private boolean social;
private long tokenExpiration;
private TimeUnit tokenExpirationUnit;
private boolean userRegistration;
public String[] getInitialRoles() {
return initialRoles;
}
public String getName() {
return name;
}
public String getOwner() {
return owner;
public String[] getRoles() {
return roles;
}
public void setKey(String key) {
this.key = key;
public long getTokenExpiration() {
return tokenExpiration;
}
public TimeUnit getTokenExpirationUnit() {
return tokenExpirationUnit;
}
public boolean isEnabled() {
return enabled;
}
public boolean isSocial() {
return social;
}
public boolean isUserRegistration() {
return userRegistration;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void setInitialRoles(String[] initialRoles) {
this.initialRoles = initialRoles;
}
public void setName(String name) {
this.name = name;
}
public void setOwner(String owner) {
this.owner = owner;
public void setRoles(String[] roles) {
this.roles = roles;
}
public void setSocial(boolean social) {
this.social = social;
}
public void setTokenExpiration(long tokenExpiration) {
this.tokenExpiration = tokenExpiration;
}
public void setTokenExpirationUnit(TimeUnit tokenExpirationUnit) {
this.tokenExpirationUnit = tokenExpirationUnit;
}
public void setUserRegistration(boolean userRegistration) {
this.userRegistration = userRegistration;
}
}

View file

@ -12,12 +12,12 @@
<link href="css/styles.css" rel="stylesheet">
<script src="lib/jquery/jquery-1.10.2.js"></script>
<script src="lib/angular/angular.js"></script>
<script src="lib/angular/angular-resource.js"></script>
<script src="lib/angular/ui-bootstrap-tpls-0.4.0.js"></script>
<script src="lib/jquery/jquery-1.10.2.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/services.js"></script>

View file

@ -4,7 +4,24 @@ var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.control
var resourceRequests = 0;
module.config([ '$routeProvider', function($routeProvider) {
$routeProvider.when('/applications/:key', {
$routeProvider.when('/create/application', {
templateUrl : 'partials/application-detail.html',
resolve : {
applications : function(ApplicationListLoader) {
return ApplicationListLoader();
},
application : function(ApplicationLoader) {
return {};
},
realms : function(RealmListLoader) {
return RealmListLoader();
},
providers : function(ProviderListLoader) {
return ProviderListLoader();
}
},
controller : 'ApplicationDetailCtrl'
}).when('/applications/:application', {
templateUrl : 'partials/application-detail.html',
resolve : {
applications : function(ApplicationListLoader) {
@ -29,7 +46,7 @@ module.config([ '$routeProvider', function($routeProvider) {
}
},
controller : 'ApplicationListCtrl'
}).when('/realms/:realmKey/users/:userId', {
}).when('/realms/:realm/users/:user', {
templateUrl : 'partials/user-detail.html',
resolve : {
realms : function(RealmListLoader) {
@ -43,7 +60,7 @@ module.config([ '$routeProvider', function($routeProvider) {
}
},
controller : 'UserDetailCtrl'
}).when('/realms/:realmKey/users', {
}).when('/realms/:realm/users', {
templateUrl : 'partials/user-list.html',
resolve : {
realms : function(RealmListLoader) {
@ -57,7 +74,18 @@ module.config([ '$routeProvider', function($routeProvider) {
}
},
controller : 'UserListCtrl'
}).when('/realms/:realmKey', {
}).when('/create/realm', {
templateUrl : 'partials/realm-detail.html',
resolve : {
realms : function(RealmListLoader) {
return RealmListLoader();
},
realm : function(RealmLoader) {
return {};
}
},
controller : 'RealmDetailCtrl'
}).when('/realms/:realm', {
templateUrl : 'partials/realm-detail.html',
resolve : {
realms : function(RealmListLoader) {
@ -127,3 +155,48 @@ module.factory('spinnerInterceptor', function($q, $window, $rootScope, $location
});
};
});
module.directive('kcInput', function() {
var d = {
scope : true,
replace: false,
link : function(scope, element, attrs) {
var form = element.closest('form');
var label = element.children('label');
var input = element.children('input');
var id = form.attr('name') + '.' + input.attr('name');
element.attr('class', 'control-group');
label.attr('class', 'control-label');
label.attr('for', id);
input.wrap('<div class="controls"/>');
input.attr('id', id);
if (!input.attr('placeHolder')) {
input.attr('placeHolder', label.text());
}
if (input.attr('required')) {
label.append(' <span class="required">*</span>');
}
}
};
return d;
});
module.directive('kcEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if(event.which === 13) {
scope.$apply(function(){
scope.$eval(attrs.kcEnter);
});
event.preventDefault();
}
});
};
});

View file

@ -16,20 +16,20 @@ module.controller('GlobalCtrl', function($scope, Auth, $location, Notifications)
});
});
module.controller('ApplicationListCtrl', function($scope, applications) {
$scope.applications = applications;
});
module.controller('ApplicationDetailCtrl', function($scope, applications, application, Application, realms, providers, $location, $window, $dialog, Notifications) {
module.controller('ApplicationDetailCtrl', function($scope, applications, application, Application, realms, providers, $location, $window, $dialog,
Notifications) {
$scope.application = angular.copy(application);
$scope.applications = applications;
$scope.realms = realms;
$scope.providers = providers;
$scope.callbackUrl = $window.location.origin + "/ejs-identity/api/callback/" + application.key;
$scope.callbackUrl = $window.location.origin + "/ejs-identity/api/callback/" + application.id;
$scope.create = !application.key;
$scope.create = !application.id;
$scope.changed = $scope.create;
@ -39,22 +39,50 @@ module.controller('ApplicationDetailCtrl', function($scope, applications, applic
}
}, true);
$scope.addRole = function() {
if ($scope.newRole) {
if (!$scope.application.roles) {
$scope.application.roles = [];
}
$scope.application.roles.push($scope.newRole);
$scope.newRole = null;
}
}
$scope.removeRole = function(i) {
$scope.application.roles.splice(i, 1);
};
$scope.addInitialRole = function() {
if ($scope.newInitialRole) {
if (!$scope.application.initialRoles) {
$scope.application.initialRoles = [];
}
$scope.application.initialRoles.push($scope.newInitialRole);
$scope.newInitialRole = null;
}
}
$scope.removeInitialRole = function(i) {
$scope.application.initialRoles.splice(i, 1);
};
$scope.save = function() {
if ($scope.applicationForm.$valid) {
if (!$scope.application.key) {
if ($scope.create) {
Application.save($scope.application, function(data, headers) {
var l = headers().location;
var key = l.substring(l.lastIndexOf("/") + 1);
$location.url("/applications/" + key);
var id = l.substring(l.lastIndexOf("/") + 1);
$location.url("/applications/" + id);
Notifications.success("Created application");
});
} else {
Application.update($scope.application, function() {
$scope.changed = false;
application = angular.copy($scope.application);
if ($scope.create) {
$location.url("/applications/" + $scope.application.key);
}
Notifications.success("Saved changes to the application");
});
}
@ -248,25 +276,50 @@ module.controller('RealmDetailCtrl', function($scope, Realm, realms, realm, $loc
}
}, true);
$scope.addRole = function() {
if ($scope.newRole) {
if (!$scope.realm.roles) {
$scope.realm.roles = [];
}
$scope.realm.roles.push($scope.newRole);
$scope.newRole = null;
}
}
$scope.removeRole = function(i) {
$scope.realm.roles.splice(i, 1);
};
$scope.addInitialRole = function() {
if ($scope.newInitialRole) {
if (!$scope.realm.initialRoles) {
$scope.realm.initialRoles = [];
}
$scope.realm.initialRoles.push($scope.newInitialRole);
$scope.newInitialRole = null;
}
}
$scope.removeInitialRole = function(i) {
$scope.realm.initialRoles.splice(i, 1);
};
$scope.save = function() {
if ($scope.realmForm.$valid) {
if (!$scope.realm.key) {
if ($scope.create) {
Realm.save($scope.realm, function(data, headers) {
var l = headers().location;
var key = l.substring(l.lastIndexOf("/") + 1);
$location.url("/realms/" + key);
var id = l.substring(l.lastIndexOf("/") + 1);
$location.url("/realms/" + id);
Notifications.success("Created realm");
});
} else {
Realm.update($scope.realm, function() {
$scope.changed = false;
realm = angular.copy($scope.realm);
if ($scope.create) {
$location.url("/realms/" + $scope.realm.key);
Notifications.success("Created realm");
} else {
Notifications.success("Saved changes to realm");
}
});
}
} else {

View file

@ -34,8 +34,8 @@ module.factory('Notifications', function($rootScope, $timeout) {
});
module.factory('Application', function($resource) {
return $resource('/keycloak-server/ui/api/applications/:key', {
key : '@key'
return $resource('/keycloak-server/ui/api/applications/:id', {
id : '@id'
}, {
update : {
method : 'PUT'
@ -57,20 +57,16 @@ module.factory('ApplicationListLoader', function(Application, $q) {
module.factory('ApplicationLoader', function(Application, $route, $q) {
return function() {
var key = $route.current.params.key;
if (key == 'new') {
return {};
} else {
var id = $route.current.params.application;
var delay = $q.defer();
Application.get({
key : key
id : id
}, function(application) {
delay.resolve(application);
}, function() {
delay.reject('Unable to fetch application ' + key);
delay.reject('Unable to fetch application ' + id);
});
return delay.promise;
}
};
});
@ -91,8 +87,8 @@ module.factory('ProviderListLoader', function(Provider, $q) {
});
module.factory('Realm', function($resource) {
return $resource('/keycloak-server/ui/api/realms/:key', {
key : '@key'
return $resource('/keycloak-server/ui/api/realms/:id', {
id : '@id'
}, {
update : {
method : 'PUT'
@ -114,27 +110,23 @@ module.factory('RealmListLoader', function(Realm, $q) {
module.factory('RealmLoader', function(Realm, $route, $q) {
return function() {
var key = $route.current.params.realmKey;
if (key == 'new') {
return {};
} else {
var id = $route.current.params.realm;
var delay = $q.defer();
Realm.get({
key : key
id : id
}, function(realm) {
delay.resolve(realm);
}, function() {
delay.reject('Unable to fetch key ' + key);
delay.reject('Unable to fetch realm ' + name);
});
return delay.promise;
}
};
});
module.factory('User', function($resource) {
return $resource('/ejs-identity/api/im/:realmKey/users/:userId', {
realmKey : '@realmKey',
userId : '@userId'
return $resource('/ejs-identity/api/im/:realm/users/:id', {
realm : '@realm',
id : '@id'
}, {
save : {
method : 'PUT'
@ -158,18 +150,18 @@ module.factory('UserListLoader', function(User, $route, $q) {
module.factory('UserLoader', function(User, $route, $q) {
return function() {
var userId = $route.current.params.userId;
if (userId == 'new') {
var name = $route.current.params.user;
if (name == 'new') {
return {};
} else {
var delay = $q.defer();
User.get({
realmKey : $route.current.params.realmKey,
userId : userId
realm : $route.current.params.realm,
name : name
}, function(user) {
delay.resolve(user);
}, function() {
delay.reject('Unable to fetch user ' + $route.current.params.userId);
delay.reject('Unable to fetch user ' + name);
});
return delay.promise;
}
@ -182,7 +174,7 @@ module.service('Auth', function($resource, $http, $location, $routeParams) {
};
auth.user = {
userId : 'test',
displayName: 'Test User'
displayName : 'Test User'
};
return auth;
});

View file

@ -15,85 +15,53 @@
<form class="form-horizontal" name="applicationForm" novalidate>
<fieldset>
<legend>Settings</legend>
<div>
<div class="control-group">
<label class="control-label" for="name">Name <span class="required">*</span></label>
<div class="controls">
<input type="text" class="input-xlarge" id="name" name="name" data-ng-model="application.name" autofocus required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="callbackUrl">Callback URL <span class="required">*</span></label>
<div class="controls">
<input type="text" class="input-xxlarge" id="callbackUrl" name="callbackUrl" data-ng-model="application.callbackUrl"
required>
</div>
</div>
<div class="control-group">
<label class="control-label" for="javaScriptOrigin">JavaScript Origin </label>
<div class="controls">
<input type="text" class="input-xxlarge" id="javaScriptOrigin" data-ng-model="application.javaScriptOrigin">
</div>
</div>
<div class="control-group">
<label class="control-label" for="key">Key </label>
<div class="controls">
<input class="input-xxlarge" type="text" id="key" data-ng-model="application.key" data-ng-readonly="!(auth.root && create)">
</div>
</div>
<div class="control-group">
<label class="control-label" for="secret">Secret </label>
<div class="controls">
<input class="input-xxlarge" type="text" id="secret" data-ng-model="application.secret" data-ng-readonly="!(auth.root && create)">
<div data-kc-input>
<label>Name</label>
<input class="input-xlarge" type="text" name="name" data-ng-model="application.name" autofocus required>
</div>
<div data-kc-input>
<label>Enabled</label>
<input class="input-xlarge" type="checkbox" name="enabled" data-ng-model="application.enabled">
</div>
<div class="control-group">
<label class="control-label" for="realm">Realm <span class="required">*</span></label>
<div class="controls">
<select data-ng-model="application.realm" id="realm" name="realm" data-ng-required>
<option data-ng-repeat="r in realms" value="{{r.key}}" data-ng-selected="r.key == application.realm">{{r.name}}</option>
<option data-ng-repeat="r in realms" value="{{r.id}}" data-ng-selected="r.id == application.realm">{{r.name}}</option>
</select>
</div>
</div>
<div class="control-group" data-ng-show="auth.root">
<label class="control-label" for="owner">Owner </label>
<div class="controls">
<input class="input-xxlarge" type="text" id="owner" data-ng-model="application.owner">
</div>
</div>
</div>
</fieldset>
<fieldset>
<legend>Identity Providers</legend>
<div>
<legend>Roles</legend>
<div class="control-group">
<label class="control-label">Roles</label>
<div class="controls">
<span style="margin-right: 1em;" data-ng-repeat="r in application.roles">{{r}} <button data-ng-click="removeRole($index)"><i class="icon-remove"></i></button></span>
<div class="input-append">
<select data-ng-model="newProviderId">
<option data-ng-repeat="p in availableProviders" value="{{p.id}}">{{p.name}}</option>
</select>
<button class="btn" data-ng-click="addProvider()" data-ng-disabled="!newProviderId">Add Provider</button>
<input class="input-small" type="text" data-ng-model="newRole" placeHolder="Role" data-kc-enter="addRole()" />
<button class="btn" type="button" data-ng-click="addRole()">Add</button>
</div>
</div>
</div>
<table class="table table-striped table-bordered margin-top" data-ng-show="application.providers.length > 0">
<thead>
<tr>
<th>Provider</th>
<th>Key <span class="required">*</span></th>
<th>Secret <span class="required">*</span></th>
<th>&nbsp;</th>
</tr>
</thead>
<tr data-ng-repeat="provider in application.providers">
<td><input type="text" placeholder="Key" value="{{getProviderDescription(provider.providerId).name}}" readonly></td>
<td>
<input type="text" placeholder="Key" data-ng-model="provider.key" required>
</td>
<td>
<input type="text" placeholder="Secret" data-ng-model="provider.secret" required>
</td>
<td><i class="icon-question-sign" data-ng-click="openHelp($index)"></i></td>
<td><i class="icon-trash" data-ng-click="removeProvider($index)"></i></td>
</tr>
</table>
<div class="control-group">
<label class="control-label">Initial Roles</label>
<div class="controls">
<span style="margin-right: 1em;" data-ng-repeat="r in application.initialRoles">{{r}} <button data-ng-click="removeInitialRole($index)"><i class="icon-remove"></i></button></span>
<div class="input-append">
<select style="width: auto;" data-ng-model="newInitialRole" data-ng-click="addInitialRole()">
<option data-ng-repeat="r in application.roles" value="{{r}}">{{r}}</option>
</select>
</div>
</div>
</div>
</fieldset>
@ -114,15 +82,3 @@
<div id="container-right-bg"></div>
</div>
</div>
<div data-modal="providerHelpModal" data-close="closeHelp()" data-options="opts">
<div class="modal-header">
<h3>Configure {{providerHelp.description.name}}</h3>
</div>
<div class="modal-body">
<div data-ng-include data-src="providerHelp && 'partials/provider/' + providerHelp.description.id + '-help.html'"></div>
</div>
<div class="modal-footer">
<button class="btn" data-ng-click="closeHelp()">Close</button>
</div>
</div>

View file

@ -4,7 +4,7 @@
<div id="actions-bg"></div>
<div id="container-right" class="span9">
<a class="btn btn-small pull-right" href="#/applications/new">Add Application</a>
<a class="btn btn-small pull-right" href="#/create/application">Add Application</a>
<h1>
<span class="gray">Applications</span>
@ -17,7 +17,7 @@
</tr>
</thead>
<tr data-ng-repeat="application in applications">
<td><a href="#/applications/{{application.key}}">{{application.name}}</a></td>
<td><a href="#/applications/{{application.id}}">{{application.name}}</a></td>
</tr>
</table>
</div>

View file

@ -5,8 +5,8 @@
<span class="toggle">Applications</span>
</div>
<ul>
<li data-ng-repeat="application in applications" data-ng-class="path[1] == application.key && 'active'">
<a href="#/applications/{{application.key}}">{{application.name}}</a>
<li data-ng-repeat="application in applications" data-ng-class="path[1] == application.id && 'active'">
<a href="#/applications/{{application.id}}">{{application.name}}</a>
</li>
</ul>
</li>

View file

@ -14,23 +14,67 @@
<form class="form-horizontal" name="realmForm" novalidate>
<fieldset>
<legend>Details</legend>
<legend>Settings</legend>
<div data-kc-input>
<label>Name</label>
<input class="input-xlarge" type="text" name="name" data-ng-model="realm.name" autofocus required>
</div>
<div data-kc-input>
<label>Enabled</label>
<input class="input-xlarge" type="checkbox" name="enabled" data-ng-model="realm.enabled">
</div>
<div data-kc-input>
<label>Social login</label>
<input class="input-xlarge" type="checkbox" name="social" data-ng-model="realm.social">
</div>
<div data-kc-input>
<label>User registration</label>
<input class="input-xlarge" type="checkbox" name="social" data-ng-model="realm.userRegistration">
</div>
<div class="control-group">
<label class="control-label" for="name">Name <span class="required">*</span></label>
<label for="realmForm-tokenExpiration" class="control-label">Token expiration</label>
<div class="controls">
<input type="text" class="input-xlarge" id="name" name="name" data-ng-model="realm.name" autofocus required>
<input class="input-small" type="text" name="tokenExpiration" data-ng-model="realm.tokenExpiration">
<select style="width: auto;" name="tokenExpirationUnit" data-ng-model="realm.tokenExpirationUnit">
<option value="SECONDS" data-ng-selected="!realm.tokenExpirationUnit">Seconds</option>
<option value="MINUTES">Minutes</option>
<option value="HOURS">Hours</option>
<option value="DAYS">Days</option>
</select>
</div>
</div>
</fieldset>
<fieldset>
<legend>Roles</legend>
<div class="control-group">
<label class="control-label" for="key">Key </label>
<label class="control-label">Roles</label>
<div class="controls">
<input class="input-xxlarge" type="text" id="key" name="key" data-ng-model="realm.key" data-ng-readonly="!(auth.root && create)">
<span style="margin-right: 1em;" data-ng-repeat="r in realm.roles">{{r}} <button data-ng-click="removeRole($index)"><i class="icon-remove"></i></button></span>
<div class="input-append">
<input class="input-small" type="text" data-ng-model="newRole" placeHolder="Role" data-kc-enter="addRole()" />
<button class="btn" type="button" data-ng-click="addRole()">Add</button>
</div>
</div>
<div class="control-group" data-ng-show="auth.root">
<label class="control-label" for="owner">Owner </label>
</div>
<div class="control-group">
<label class="control-label">Initial Roles</label>
<div class="controls">
<input class="input-xxlarge" type="text" id="owner" data-ng-model="realm.owner">
<span style="margin-right: 1em;" data-ng-repeat="r in realm.initialRoles">{{r}} <button data-ng-click="removeInitialRole($index)"><i class="icon-remove"></i></button></span>
<div class="input-append">
<select style="width: auto;" data-ng-model="newInitialRole" data-ng-click="addInitialRole()">
<option data-ng-repeat="r in realm.roles" value="{{r}}">{{r}}</option>
</select>
</div>
</div>
</div>
</fieldset>

View file

@ -4,7 +4,7 @@
<div id="actions-bg"></div>
<div id="container-right" class="span9">
<a class="btn btn-small pull-right" href="#/realms/new">Add Realm</a>
<a class="btn btn-small pull-right" href="#/create/realm">Add Realm</a>
<h1>
<span class="gray">Realms</span>
@ -17,7 +17,7 @@
</tr>
</thead>
<tr data-ng-repeat="r in realms">
<td><a href="#/realms/{{r.key}}">{{r.name}}</a></td>
<td><a href="#/realms/{{r.id}}">{{r.name}}</a></td>
</tr>
</table>
</div>

View file

@ -5,11 +5,11 @@
<span class="toggle">Realms</span>
</div>
<ul>
<li data-ng-repeat="r in realms" data-ng-class="realm.key == r.key && 'active'">
<a href=#/realms/{{r.key}}>{{r.name}}</a>
<ul class="sub-items" data-ng-show="realm.key == r.key">
<li data-ng-class="!path[2] && 'active'"><a href="#/realms/{{r.key}}">Configuration</a></li>
<li data-ng-class="path[2] == 'users' && 'active'"><a href="#/realms/{{r.key}}/users">Users</a></li>
<li data-ng-repeat="r in realms" data-ng-class="realm.id == r.id && 'active'">
<a href=#/realms/{{r.id}}>{{r.name}}</a>
<ul class="sub-items" data-ng-show="realm.id == r.id">
<li data-ng-class="!path[2] && 'active'"><a href="#/realms/{{r.id}}">Configuration</a></li>
<li data-ng-class="path[2] == 'users' && 'active'"><a href="#/realms/{{r.id}}/users">Users</a></li>
</ul>
</li>
</ul>