Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into closure
Browse files Browse the repository at this point in the history
Conflicts:
	infra/schema/.gitignore
  • Loading branch information
1azyman committed Aug 4, 2014
2 parents 6708731 + 10218be commit 49d894f
Show file tree
Hide file tree
Showing 186 changed files with 5,375 additions and 1,607 deletions.
15 changes: 13 additions & 2 deletions build-system/pom.xml
Expand Up @@ -48,8 +48,9 @@
<cxf.version>3.0.1.e1</cxf.version>
<cxf-xjc.version>3.0.1</cxf-xjc.version>
<dbunit.version>2.4.7</dbunit.version>
<jaxb.version>2.2.7</jaxb.version>
<jaxb-xjc.version>2.2.7</jaxb-xjc.version>
<jaxb-api.version>2.2.9</jaxb-api.version>
<jaxb.version>2.2.10-b140310.1920</jaxb.version>
<jaxb-xjc.version>2.2.10-b140310.1920</jaxb-xjc.version>
<junit.version>4.8.2</junit.version>
<opendj.version>2.4.3</opendj.version>
<mockito.version>1.8.5</mockito.version>
Expand Down Expand Up @@ -178,11 +179,21 @@
<artifactId>je</artifactId>
<version>4.1.10</version>
</dependency>
<dependency>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xsom</groupId>
<artifactId>xsom</artifactId>
Expand Down
2 changes: 0 additions & 2 deletions gui/admin-gui/pom.xml
Expand Up @@ -594,12 +594,10 @@
<dependency>
<artifactId>jaxb-api</artifactId>
<groupId>javax.xml.bind</groupId>
<version>${jaxb.version}</version>
</dependency>
<dependency>
<artifactId>jaxb-core</artifactId>
<groupId>com.sun.xml.bind</groupId>
<version>${jaxb.version}</version>
</dependency>
</dependencies>

Expand Down
Expand Up @@ -22,6 +22,8 @@
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ReportTypeUtil;
Expand Down Expand Up @@ -177,16 +179,18 @@ private Boolean importObject(PrismObject object, File file, Task task, Operation

boolean importObject = true;
try {
model.getObject(object.getCompileTimeClass(), object.getOid(), null, task, result);
model.getObject(object.getCompileTimeClass(), object.getOid(), SelectorOptions.createCollection(GetOperationOptions.createAllowNotFound()), task, result);
importObject = false;
result.recordSuccess();
} catch (ObjectNotFoundException ex) {
importObject = true;
} catch (Exception ex) {
LoggingUtils.logException(LOGGER, "Couldn't get object with oid {} from model", ex,
object.getOid());
result.recordWarning("Couldn't get object with oid '" + object.getOid() + "' from model",
ex);
if (!importObject){
LoggingUtils.logException(LOGGER, "Couldn't get object with oid {} from model", ex,
object.getOid());
result.recordWarning("Couldn't get object with oid '" + object.getOid() + "' from model",
ex);
}
}

if (!importObject) {
Expand Down
Expand Up @@ -185,11 +185,28 @@ private void scanPackagesForPages(List<String> packages, MidPointApplication app
private void loadActions(PageDescriptor descriptor) {
for (String url : descriptor.url()) {
List<AuthorizationActionValue> actions = new ArrayList<>();

//avoid of setting guiAll authz for "public" pages (e.g. login page)
if (descriptor.action() == null || descriptor.action().length == 0){
return;
}

boolean canAccess = true;

for (AuthorizationAction action : descriptor.action()) {
actions.add(new AuthorizationActionValue(action.actionUri(), action.label(), action.description()));
if (AuthorizationConstants.AUTZ_NO_ACCESS_URL.equals(action.actionUri())){
canAccess = false;
break;
}
}
actions.add(new AuthorizationActionValue(AuthorizationConstants.AUTZ_GUI_ALL_URI,

//add http://.../..#guAll authorization only for displayable pages, not for pages used for development..
if (canAccess){

actions.add(new AuthorizationActionValue(AuthorizationConstants.AUTZ_GUI_ALL_URI,
AuthorizationConstants.AUTZ_GUI_ALL_LABEL, AuthorizationConstants.AUTZ_GUI_ALL_DESCRIPTION));
}
this.actions.put(url, actions.toArray(new DisplayableValue[actions.size()]));
}
}
Expand Down
Expand Up @@ -17,11 +17,16 @@
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.PrismProperty;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto;
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.web.util.WebModelUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;

Expand All @@ -36,24 +41,29 @@
*/
public class AssignmentEditorDto extends SelectableBean implements Comparable<AssignmentEditorDto> {

private static final String DOT_CLASS = AssignmentEditorDto.class.getName() + ".";
private static final String OPERATION_LOAD_ORG_TENANT = DOT_CLASS + "loadTenantOrg";

public static final String F_TYPE = "type";
public static final String F_NAME = "name";
public static final String F_DESCRIPTION = "description";
public static final String F_ACTIVATION = "activation";
public static final String F_RELATION = "relation";
public static final String F_TENANT_REF = "tenantRef";

private String name;
private AssignmentEditorDtoType type;
private UserDtoStatus status;
private AssignmentType oldAssignment;
private ObjectViewDto<OrgType> tenantRef;

private boolean showEmpty = false;
private boolean minimized = true;

private AssignmentType newAssignment;
private List<ACAttributeDto> attributes;

public AssignmentEditorDto(ObjectType targetObject, AssignmentEditorDtoType type, UserDtoStatus status, AssignmentType assignment) {
public AssignmentEditorDto(ObjectType targetObject, AssignmentEditorDtoType type, UserDtoStatus status, AssignmentType assignment, PageBase pageBase) {
Validate.notNull(status, "User dto status must not be null.");
Validate.notNull(type, "Type must not be null.");
Validate.notNull(assignment, "Assignment must not be null.");
Expand All @@ -75,9 +85,32 @@ public AssignmentEditorDto(ObjectType targetObject, AssignmentEditorDtoType type
// newAssignment.setConstruction(construction.clone());
// }

this.tenantRef = loadTenantReference(targetObject, assignment, pageBase);

this.name = getNameForTargetObject(targetObject);
}

private ObjectViewDto loadTenantReference(ObjectType object, AssignmentType assignment, PageBase page){
ObjectViewDto dto;

if(object instanceof RoleType){
if(assignment.getTenantRef() != null){
ObjectReferenceType ref = assignment.getTenantRef();

OperationResult result = new OperationResult(OPERATION_LOAD_ORG_TENANT);
PrismObject<OrgType> org = WebModelUtils.loadObject(OrgType.class, ref.getOid(), result, page);

dto = new ObjectViewDto(ref.getOid(), WebMiscUtil.getName(org.asObjectable()));
dto.setType(OrgType.class);
return dto;
}
}

dto = new ObjectViewDto();
dto.setType(OrgType.class);
return dto;
}

private String getNameForTargetObject(ObjectType object) {
if (object == null) {
return null;
Expand Down Expand Up @@ -105,12 +138,18 @@ private String getNameForTargetObject(ObjectType object) {
builder.append(" (").append(getRelation()).append(')');
}

if(object instanceof RoleType){
if(tenantRef != null && tenantRef.getOid() != null){
builder.append(" - ").append(tenantRef.getName());
}
}

return builder.toString();
}

public List<ACAttributeDto> getAttributes() {
if (attributes == null) {
attributes = new ArrayList<ACAttributeDto>();
attributes = new ArrayList<>();
}
return attributes;
}
Expand Down Expand Up @@ -181,6 +220,16 @@ public PrismContainerValue getNewValue() throws SchemaException {
newAssignment.setActivation(null);
}

if(tenantRef != null && AssignmentEditorDtoType.ROLE.equals(this.type)){
if(tenantRef.getOid() == null){
newAssignment.setTenantRef(null);
} else {
ObjectReferenceType ref = new ObjectReferenceType();
ref.setOid(this.tenantRef.getOid());
newAssignment.setTenantRef(ref);
}
}

ConstructionType construction = newAssignment.getConstruction();
if (construction == null) {
return newAssignment.asPrismContainerValue();
Expand Down Expand Up @@ -245,4 +294,12 @@ private int getIndexOfType(AssignmentEditorDtoType type) {

return 0;
}

public ObjectViewDto<OrgType> getTenantRef() {
return tenantRef;
}

public void setTenantRef(ObjectViewDto<OrgType> tenantRef) {
this.tenantRef = tenantRef;
}
}
Expand Up @@ -53,6 +53,13 @@
</div>
</div>

<div wicket:id="tenantRefContainer" class="row">
<div class="col-xs-4">
<span><wicket:message key="AssignmentEditorPanel.tenantRef" /></span>
</div>
<div wicket:id="tenantRefChooser"/>
</div>

<div class="row" wicket:id="activationBlock">
<div class="col-xs-12">
<h4>
Expand Down
Expand Up @@ -19,6 +19,9 @@
import com.evolveum.midpoint.common.refinery.RefinedResourceSchema;
import com.evolveum.midpoint.model.api.ModelService;
import com.evolveum.midpoint.prism.*;
import com.evolveum.midpoint.prism.query.EqualFilter;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand All @@ -34,6 +37,9 @@
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.PageBase;
import com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypeDialog;
import com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel;
import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

Expand Down Expand Up @@ -98,10 +104,11 @@ public class AssignmentEditorPanel extends SimplePanel<AssignmentEditorDto> {
private static final String ID_TARGET = "target";
private static final String ID_TARGET_CONTAINER = "targetContainer";
private static final String ID_CONSTRUCTION_CONTAINER = "constructionContainer";
private static final String ID_CONTAINER_TENANT_REF = "tenantRefContainer";
private static final String ID_TENANT_CHOOSER = "tenantRefChooser";

private IModel<List<ACAttributeDto>> attributesModel;


public AssignmentEditorPanel(String id, IModel<AssignmentEditorDto> model) {
super(id, model);

Expand Down Expand Up @@ -250,6 +257,39 @@ private void initBodyLayout(WebMarkupContainer body) {
relation.setEnabled(false);
body.add(relation);

//TODO - add VisibleEnableBehaviour so we can only edit tenantRef in RoleAssignments
WebMarkupContainer tenantRefContainer = new WebMarkupContainer(ID_CONTAINER_TENANT_REF);
ChooseTypePanel tenantRef = new ChooseTypePanel(ID_TENANT_CHOOSER,
new PropertyModel<ObjectViewDto>(getModel(), AssignmentEditorDto.F_TENANT_REF)){

@Override
protected ObjectQuery getChooseQuery(){
ObjectQuery query = new ObjectQuery();

ObjectFilter filter = EqualFilter.createEqual(OrgType.F_TENANT, OrgType.class,
getPageBase().getPrismContext(), null, true);
query.setFilter(filter);

return query;
}
};
tenantRefContainer.add(tenantRef);
tenantRefContainer.add(new VisibleEnableBehaviour(){

@Override
public boolean isVisible() {
AssignmentEditorDto dto = getModel().getObject();
if(dto != null){
if(AssignmentEditorDtoType.ROLE.equals(dto.getType())){
return true;
}
}

return false;
}
});
body.add(tenantRefContainer);

WebMarkupContainer activationBlock = new WebMarkupContainer(ID_ACTIVATION_BLOCK);
activationBlock.add(new VisibleEnableBehaviour() {

Expand Down
Expand Up @@ -24,5 +24,6 @@ AssignmentEditorPanel.enabledFromTo={0}, from {1,date,medium} to {2,date,medium}
AssignmentEditorPanel.enabledFrom={0}, from {1,date,medium}
AssignmentEditorPanel.enabledTo={0}, to {1,date,medium}
AssignmentEditorPanel.relation=Relation
AssignmentEditorPanel.tenantRef=Tenant


Expand Up @@ -133,7 +133,7 @@ public List<AssignmentEditorDto> loadFromAssignmentTypeList(List<AssignmentType>
}
}

list.add(new AssignmentEditorDto(targetObject, type, UserDtoStatus.MODIFY, assignment));
list.add(new AssignmentEditorDto(targetObject, type, UserDtoStatus.MODIFY, assignment, getPageBase()));
}

Collections.sort(list);
Expand Down Expand Up @@ -383,7 +383,7 @@ private void addSelectedAssignablePerformed(AjaxRequestTarget target, List<Objec
AssignmentType assignment = new AssignmentType();
assignment.setTargetRef(targetRef);

AssignmentEditorDto dto = new AssignmentEditorDto(object, aType, UserDtoStatus.ADD, assignment);
AssignmentEditorDto dto = new AssignmentEditorDto(object, aType, UserDtoStatus.ADD, assignment, getPageBase());
dto.setMinimized(false);
dto.setShowEmpty(true);

Expand Down Expand Up @@ -414,7 +414,7 @@ private void addSelectedResourceAssignPerformed(ResourceType resource) {

List<AssignmentEditorDto> assignments = assignmentModel.getObject();
AssignmentEditorDto dto = new AssignmentEditorDto(resource, AssignmentEditorDtoType.ACCOUNT_CONSTRUCTION,
UserDtoStatus.ADD, assignment);
UserDtoStatus.ADD, assignment, getPageBase());
assignments.add(dto);

dto.setMinimized(false);
Expand Down

0 comments on commit 49d894f

Please sign in to comment.