commit
2ad873a87f
12 changed files with 6 additions and 52 deletions
|
@ -52,10 +52,6 @@
|
|||
required> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group clearfix block">
|
||||
<label for="composite" class="control-label">Composite</label>
|
||||
<input ng-model="role.composite" name="composite" id="composite" onoffswitch />
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="form-actions" data-ng-show="create">
|
||||
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
||||
|
@ -74,7 +70,7 @@
|
|||
Delete
|
||||
</button>
|
||||
</div>
|
||||
<fieldset data-ng-show="!create && role.composite">
|
||||
<fieldset data-ng-show="!create">
|
||||
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
||||
<div class="form-group">
|
||||
<div class="controls changing-selectors">
|
||||
|
@ -102,7 +98,7 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset ng-show="applications.length > 0 && !create && role.composite">
|
||||
<fieldset ng-show="applications.length > 0 && !create">
|
||||
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
||||
<div class="form-group input-select">
|
||||
<label for="applications">Application</label>
|
||||
|
|
|
@ -47,10 +47,6 @@
|
|||
<textarea rows="5" cols="50" id="description" name="description" data-ng-model="role.description"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group clearfix block">
|
||||
<label for="composite" class="control-label">Composite</label>
|
||||
<input ng-model="role.composite" name="composite" id="composite" onoffswitch />
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="form-actions" data-ng-show="create">
|
||||
<button type="submit" kc-save class="primary" data-ng-show="changed">Save
|
||||
|
@ -70,7 +66,7 @@
|
|||
</button>
|
||||
</div>
|
||||
|
||||
<fieldset data-ng-show="!create && role.composite">
|
||||
<fieldset data-ng-show="!create">
|
||||
<legend collapsed><span class="text">Composite Realm Roles</span> </legend>
|
||||
<div class="form-group">
|
||||
<div class="controls changing-selectors">
|
||||
|
@ -98,7 +94,7 @@
|
|||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset ng-show="applications.length > 0 && !create && role.composite">
|
||||
<fieldset ng-show="applications.length > 0 && !create">
|
||||
<legend collapsed><span class="text">Composite Application Roles</span> </legend>
|
||||
<div class="form-group input-select">
|
||||
<label for="applications">Application</label>
|
||||
|
|
|
@ -12,7 +12,6 @@ public class RoleRepresentation {
|
|||
protected String id;
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected boolean composite;
|
||||
protected Composites composites;
|
||||
|
||||
public static class Composites {
|
||||
|
@ -69,14 +68,6 @@ public class RoleRepresentation {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isComposite() {
|
||||
return composite;
|
||||
}
|
||||
|
||||
public void setComposite(boolean composite) {
|
||||
this.composite = composite;
|
||||
}
|
||||
|
||||
public Composites getComposites() {
|
||||
return composites;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ public interface RoleModel {
|
|||
|
||||
boolean isComposite();
|
||||
|
||||
void setComposite(boolean flag);
|
||||
|
||||
void addCompositeRole(RoleModel role);
|
||||
|
||||
void removeCompositeRole(RoleModel role);
|
||||
|
|
|
@ -62,12 +62,7 @@ public class RoleAdapter implements RoleModel {
|
|||
|
||||
@Override
|
||||
public boolean isComposite() {
|
||||
return role.isComposite();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposite(boolean flag) {
|
||||
role.setComposite(flag);
|
||||
return getComposites().size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,6 @@ public abstract class RoleEntity {
|
|||
|
||||
private String name;
|
||||
private String description;
|
||||
private boolean composite;
|
||||
@ManyToMany(fetch = FetchType.LAZY, cascade = {})
|
||||
//@JoinTable(name = "COMPOSITE_ROLE")
|
||||
private Collection<RoleEntity> compositeRoles = new ArrayList<RoleEntity>();
|
||||
|
@ -56,14 +55,6 @@ public abstract class RoleEntity {
|
|||
this.description = description;
|
||||
}
|
||||
|
||||
public boolean isComposite() {
|
||||
return composite;
|
||||
}
|
||||
|
||||
public void setComposite(boolean composite) {
|
||||
this.composite = composite;
|
||||
}
|
||||
|
||||
public Collection<RoleEntity> getCompositeRoles() {
|
||||
return compositeRoles;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@ public class ModelToRepresentation {
|
|||
rep.setId(role.getId());
|
||||
rep.setName(role.getName());
|
||||
rep.setDescription(role.getDescription());
|
||||
rep.setComposite(role.isComposite());
|
||||
return rep;
|
||||
}
|
||||
|
||||
|
|
|
@ -260,7 +260,6 @@ public class RealmManager {
|
|||
for (RoleRepresentation roleRep : entry.getValue()) {
|
||||
RoleModel role = app.addRole(roleRep.getName());
|
||||
role.setDescription(roleRep.getDescription());
|
||||
role.setComposite(roleRep.isComposite());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +374,7 @@ public class RealmManager {
|
|||
}
|
||||
|
||||
public void addComposites(RoleModel role, RoleRepresentation roleRep, RealmModel realm) {
|
||||
if (!roleRep.isComposite() || roleRep.getComposites() == null) return;
|
||||
if (roleRep.getComposites() == null) return;
|
||||
if (roleRep.getComposites().getRealm() != null) {
|
||||
for (String roleStr : roleRep.getComposites().getRealm()) {
|
||||
RoleModel realmRole = realm.getRole(roleStr);
|
||||
|
@ -404,7 +403,6 @@ public class RealmManager {
|
|||
public void createRole(RealmModel newRealm, RoleRepresentation roleRep) {
|
||||
RoleModel role = newRealm.addRole(roleRep.getName());
|
||||
if (roleRep.getDescription() != null) role.setDescription(roleRep.getDescription());
|
||||
role.setComposite(roleRep.isComposite());
|
||||
}
|
||||
|
||||
public void createRole(RealmModel newRealm, ApplicationModel app, RoleRepresentation roleRep) {
|
||||
|
|
|
@ -59,7 +59,6 @@ public class RoleContainerResource extends RoleResource {
|
|||
throw new NotFoundException();
|
||||
}
|
||||
role.setDescription(rep.getDescription());
|
||||
role.setComposite(rep.isComposite());
|
||||
return Response.created(uriInfo.getAbsolutePathBuilder().path(role.getName()).build()).build();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ public class RoleResource {
|
|||
protected void updateRole(RoleRepresentation rep, RoleModel role) {
|
||||
role.setName(rep.getName());
|
||||
role.setDescription(rep.getDescription());
|
||||
role.setComposite(rep.isComposite());
|
||||
}
|
||||
|
||||
protected void addComposites(List<RoleRepresentation> roles, RoleModel role) {
|
||||
|
@ -45,7 +44,6 @@ public class RoleResource {
|
|||
if (composite == null) {
|
||||
throw new NotFoundException("Could not find composite role: " + rep.getName());
|
||||
}
|
||||
if (!role.isComposite()) role.setComposite(true);
|
||||
role.addCompositeRole(composite);
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +94,5 @@ public class RoleResource {
|
|||
}
|
||||
role.removeCompositeRole(composite);
|
||||
}
|
||||
if (role.getComposites().size() == 0) role.setComposite(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ public class CompositeRoleTest {
|
|||
final RoleModel realmRole2 = realm.addRole("REALM_ROLE_2");
|
||||
final RoleModel realmRole3 = realm.addRole("REALM_ROLE_3");
|
||||
final RoleModel realmComposite1 = realm.addRole("REALM_COMPOSITE_1");
|
||||
realmComposite1.setComposite(true);
|
||||
realmComposite1.addCompositeRole(realmRole1);
|
||||
|
||||
final UserModel realmComposite1User = realm.addUser("REALM_COMPOSITE_1_USER");
|
||||
|
@ -106,7 +105,6 @@ public class CompositeRoleTest {
|
|||
final RoleModel appRole2 = appRoleApplication.addRole("APP_ROLE_2");
|
||||
|
||||
final RoleModel realmAppCompositeRole = realm.addRole("REALM_APP_COMPOSITE_ROLE");
|
||||
realmAppCompositeRole.setComposite(true);
|
||||
realmAppCompositeRole.addCompositeRole(appRole1);
|
||||
|
||||
final UserModel realmAppCompositeUser = realm.addUser("REALM_APP_COMPOSITE_USER");
|
||||
|
@ -125,7 +123,6 @@ public class CompositeRoleTest {
|
|||
appCompositeApplication.setManagementUrl("http://localhost:8081/app/logout");
|
||||
realm.updateCredential(appCompositeApplication.getApplicationUser(), UserCredentialModel.password("password"));
|
||||
final RoleModel appCompositeRole = appCompositeApplication.addRole("APP_COMPOSITE_ROLE");
|
||||
appCompositeRole.setComposite(true);
|
||||
appCompositeApplication.addScope(appRole2);
|
||||
appCompositeRole.addCompositeRole(realmRole1);
|
||||
appCompositeRole.addCompositeRole(realmRole2);
|
||||
|
|
|
@ -164,14 +164,12 @@
|
|||
},
|
||||
{
|
||||
"name": "REALM_COMPOSITE_1",
|
||||
"composite": true,
|
||||
"composites": {
|
||||
"realm": ["REALM_ROLE_1"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "REALM_APP_COMPOSITE_ROLE",
|
||||
"composite": true,
|
||||
"composites": {
|
||||
"application": {
|
||||
"APP_ROLE_APPLICATION" :[
|
||||
|
@ -193,7 +191,6 @@
|
|||
"APP_COMPOSITE_APPLICATION" : [
|
||||
{
|
||||
"name": "APP_COMPOSITE_ROLE",
|
||||
"composite": true,
|
||||
"composites": {
|
||||
"realm" : [
|
||||
"REALM_ROLE_1",
|
||||
|
|
Loading…
Reference in a new issue