Skip to content

Commit

Permalink
Merge branch 'feature/service-accounts' into feature/consistency-update
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Aug 6, 2018
2 parents ec6e767 + 009e996 commit a9defae
Show file tree
Hide file tree
Showing 144 changed files with 6,293 additions and 3,292 deletions.
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
@@ -0,0 +1,42 @@
MidPoint is open to contributions. Any contribution is appreciated whether it is documentation update, localization, bugfix or a new feature. Anyone can start experimenting with midPoint code without the need to ask for any privileges or access to our source code repository. Git distributed development model allows this to be done easily. This pages describes how to do it. It describes how to create and contribute a simple bugfix and also how to cooperate with the midPoint team in a longer run.

Communication
=============

Communication with core midPoint development team is crucial for any successful participation in midPoint development. There are several methods to communicate with the core team:
* [Mailing lists](https://wiki.evolveum.com/display/midPoint/Mailing+Lists) are general-purpose communication mechanisms for midPoint community. All mailing lists are public. Almost any conversation is allowed on mailing lists as long as it is kept reasonable and polite. This includes conversation regarding development topics. However, the nature of a mailing list can make the conversation somehow slow and inflexible.
* [Bug-tracking System](https://wiki.evolveum.com/display/midPoint/Bug-tracking+System) is open to anyone to search, open a bug report or participate on existing bug reports.
* [Development chat room](https://wiki.evolveum.com/display/midPoint/Development+Chat) on gitter can be used as a faster communication channel. The room is public. However, the room is limited to development conversations. It is OK to discuss your contribution, planned contribution, development idea, localization, documentation updates and similar topics on this chat. However, the chat room is not supposed to be a replacement for subscription and support.
* There are other private communication channels available for midPoint subscribers - and platform subscribers in particular. Please contact Evolveum for the details.

Git
===

Evolveum maintains midPoint repository on GitHub:

[https://github.com/Evolveum/midpoint](https://github.com/Evolveum/midpoint)

This is the primary midPoint repository. GitHub users may use this repository to submit a contribution. This is the easiest way how individual developers can contribute to midPoint. Simply fork midPoint project on github, make the changes and when finished create a pull request. Please see github documentation for the details.

Tips and Best Practice
======================
* Do not submit each individual commit unless the commit itself is a complete contribution. If your contribution is divided into several commits (which is perfectly fine) then send all the commits together so the maintainer can apply and test them together.
* If you have many commits but you want only to show them as one in the final midPoint history you might want to squash these commits to one. You can use git interactive rebasing to do this. (git rebase -i, the Git book provides more details)
* Provide a meaningful commit message. If the commit message is longer than a single line provide a short summary of the message in the first line and then provide more details in subsequent lines. Most git tools display just the first line of the commit message therefore the developers should be able to get an idea about the commit just from the first line.
* If there is an "issue" created in our bug-tracking system it is recommended to include issue identifier in the commit message.
* You may want to create a topic branch for larger contributions.
* There is no code ownership principle. Not in the midPoint development team and we do not provide that to the contributions as well. All code "belongs" to every developer and anyone has the "right" to modify any code. The only thing that we care about is the quality of the modification, not its origin. Therefore feel free to modify any code and fix bugs anywhere in the midPoint core or in any of the contributions. Just please make sure you know what you are doing. If you are not you are free to discuss that on midpoint-dev mailing list. If you contribute a code be prepared that others may modify it. If you do not want others to "ruin" you code then do not contribute it.
* MidPoint core team is trying to be quite careful about the state of the master branch in main midPoint repository. We try very hard not to break the build and we are also careful about passing tests and overall code quality. But this is software development and we are only human beings. Therefore it may happen that we break something occasionally. Therefore it is good idea to check the state of the source code before pulling from the main midPoint repository. The easiest way to do this is by looking at our continuous integration system. If it is mostly green then it is probably OK to pull changes. If it is too red it is better to postpone the pull for a while.
* Also write tests (e.g. integration tests) not just the main code. If you are fixing a bug try to write a test for the bug first and fix the bug second. For larger pieces of functionality try to create a fair amount of test code. Submit the tests as part of your contribution. You write the tests for your own good. As there is no code ownership anyone might (unintentionally) break your code. If you have good tests for the code the problem will be detected soon after the modification while it is still easy to fix. If you have no tests then you code will break without anyone noticing it for quite a long time. This will cause that your contribution might "corrode" over time and it may even be removed from the main code if its quality drops too low.
* For more details about contributing using git please see the "Distributed Git - Contributing to a Project" chapter of the Git book. In fact the whole book is more than worth reading.

Licence and Credit
==================
MidPoint is developed under Apache Licence. By submitting your contribution to the main midPoint repository you agree to the terms of the Licence and you contribute your work under this licence. There is no other contributor agreement and we do not ask for copyright assignment. All work is licensed under the Apache licence. That's the only rule. We are very strict about maintaining midPoint open source character and therefore we will not accept any contribution under a different licence (using publicly available third-party open source libraries is OK as long as they are available under any compatible OSI-approved licence - except for hard copyleft licenses such as GPL). Each new contributed file must have appropriate header declaring licensing under Apache Licence otherwise the contribution might be refused.

Git maintains the commit meta-data of the original commit. And this is what will be recorded in the history trail of main midPoint repository. Therefore the original contributor will be recorded in each commit. Apart from this the contributors are free to add their names to the appropriate place in the file header (e.g. Java @author annotation) if they feel their contribution is big enough to justify it.

Development Guidelines
======================

See [Development Guidelines](https://wiki.evolveum.com/display/midPoint/Development+Guidelines)
7 changes: 3 additions & 4 deletions build-system/pom.xml
Expand Up @@ -63,9 +63,8 @@
<selenium.version>1.0.1</selenium.version>
<slf4j.version>1.7.25</slf4j.version>
<logback.version>1.2.3</logback.version>
<spring.boot.version>2.0.1.RELEASE</spring.boot.version> <!-- can be replaced by a stock version;
ideally after https://github.com/spring-projects/spring-boot/issues/11367 is resolved but it should be OK even before that -->
<spring.version>5.0.6.RELEASE</spring.version>
<spring.boot.version>2.0.3.RELEASE</spring.boot.version>
<spring.version>5.0.7.RELEASE</spring.version>
<spring.security.version>5.0.6.RELEASE</spring.security.version>
<cas.client.version>3.5.0</cas.client.version>
<testng.version>6.8.8</testng.version>
Expand All @@ -89,7 +88,7 @@
<derby.version>10.11.1.1</derby.version>
<wro4j.version>1.8.0</wro4j.version>
<jackson.version>2.9.5</jackson.version>
<snakeyaml.version>1.15</snakeyaml.version>
<snakeyaml.version>1.19</snakeyaml.version>
<surefire.version>2.20.1</surefire.version>
<reflections.version>0.9.11</reflections.version>
<guava.version>20.0</guava.version>
Expand Down
Expand Up @@ -38,7 +38,7 @@ public abstract class AbstractPopupTabPanel<O extends ObjectType> extends BasePa
private static final long serialVersionUID = 1L;

private static final String ID_OBJECT_LIST_PANEL = "objectListPanel";
private static final String ID_PARAMETERS_PANEL = "parametersPanel";
protected static final String ID_PARAMETERS_PANEL = "parametersPanel";
protected static final String ID_PARAMETERS_PANEL_FRAGMENT = "parametersPanelFragment";

protected List<O> preSelectedObjects = new ArrayList<>();
Expand Down
Expand Up @@ -60,9 +60,9 @@ public abstract class ChooseMemberPopup<O extends ObjectType, T extends Abstract
private static final String ID_FORM = "form";

private List<OrgType> selectedOrgsList = new ArrayList<>();
protected List<RelationTypes> availableRelationList;
protected List<QName> availableRelationList;

public ChooseMemberPopup(String id, List<RelationTypes> availableRelationList){
public ChooseMemberPopup(String id, List<QName> availableRelationList){
super(id);
this.availableRelationList = availableRelationList;
}
Expand Down Expand Up @@ -323,7 +323,7 @@ protected ObjectQuery createInOidQuery(List<ObjectType> selectedObjectsList){
protected void executeMemberOperation(QName type, ObjectQuery memberQuery,
ObjectDelta delta, AjaxRequestTarget target) {

Task operationalTask = getPageBase().createSimpleTask("add members");
Task operationalTask = getPageBase().createSimpleTask("Add.members");
OperationResult parentResult = operationalTask.getResult();

try {
Expand Down
Expand Up @@ -29,13 +29,13 @@
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.WebMarkupContainer;

import java.util.ArrayList;
import javax.xml.namespace.QName;
import java.util.List;

public abstract class ChooseMemberForOrgPopup<O extends ObjectType> extends ChooseMemberPopup<O, OrgType> {
public abstract class ChooseOrgMemberPopup<O extends ObjectType> extends ChooseMemberPopup<O, OrgType> {
private static final long serialVersionUID = 1L;

public ChooseMemberForOrgPopup(String id, List<RelationTypes> availableRelationList){
public ChooseOrgMemberPopup(String id, List<QName> availableRelationList){
super(id, availableRelationList);
}

Expand All @@ -58,7 +58,7 @@ protected void onSelectionPerformed(AjaxRequestTarget target){

@Override
protected OrgType getAbstractRoleTypeObject(){
return ChooseMemberForOrgPopup.this.getAssignmentTargetRefObject();
return ChooseOrgMemberPopup.this.getAssignmentTargetRefObject();
}
};
}
Expand Down
Expand Up @@ -15,29 +15,25 @@
*/
package com.evolveum.midpoint.gui.api.component;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.model.api.ModelInteractionService;
import com.evolveum.midpoint.model.api.RoleSelectionSpecification;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.RelationTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior;
import com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel;
import com.evolveum.midpoint.web.security.SecurityUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AreaCategoryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;
import org.apache.commons.collections.map.HashedMap;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.model.Model;

import javax.xml.namespace.QName;
import java.util.*;
Expand Down Expand Up @@ -66,13 +62,7 @@ protected void initParametersPanel(Fragment parametersPanel){
relationContainer.setOutputMarkupId(true);
parametersPanel.add(relationContainer);

DropDownChoicePanel<RelationTypes> relationSelector = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION,
WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), Model.of(RelationTypes.MEMBER),
FocusTypeAssignmentPopupTabPanel.this, false);
relationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relationSelector.setOutputMarkupId(true);
relationSelector.setOutputMarkupPlaceholderTag(true);
relationContainer.add(relationSelector);
relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, AreaCategoryType.ADMINISTRATION));
}

@Override
Expand All @@ -88,16 +78,12 @@ protected Map<String, AssignmentType> getSelectedAssignmentsMap(){
}

public QName getRelationValue(){
DropDownChoicePanel<RelationTypes> relationPanel = getRelationDropDown();
RelationTypes relation = relationPanel.getModel().getObject();
if (relation == null) {
return SchemaConstants.ORG_DEFAULT;
}
return relation.getRelation();
RelationDropDownChoicePanel relationPanel = getRelationDropDown();
return relationPanel.getRelationValue();
}

private DropDownChoicePanel getRelationDropDown(){
return (DropDownChoicePanel)get(ID_RELATION_CONTAINER).get(ID_RELATION);
private RelationDropDownChoicePanel getRelationDropDown(){
return (RelationDropDownChoicePanel)get(ID_PARAMETERS_PANEL).get(ID_RELATION_CONTAINER).get(ID_RELATION);
}

@Override
Expand Down
Expand Up @@ -176,7 +176,7 @@ public void onClick(AjaxRequestTarget target) {
// isVisible = ((PageBase) getPage()).getSecurityEnforcer().isAuthorized(ModelAuthorizationAction.ADD.getUrl(),
// null, objectToCreate, null, null, null);
// } catch (Exception ex){
// LOGGER.error("Failed to check authorization for ADD action on new object of " + mainObjectListPanel.getType().getSimpleName()
// LOGGER.error("Failed to check authorization for ADD action on new object of " + mainObjectListPanel.getQueryType().getSimpleName()
// + " type, ", ex);
// }
// return isVisible;
Expand Down
Expand Up @@ -21,12 +21,14 @@
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.RelationTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.LoggingUtils;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.input.RelationDropDownChoicePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnChangeAjaxFormUpdatingBehavior;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
Expand All @@ -51,9 +53,9 @@ public abstract class MemberPopupTabPanel<O extends ObjectType> extends Abstract
private static final String ID_RELATION = "relation";

private PageBase pageBase;
private List<RelationTypes> supportedRelationList = new ArrayList<>();
private List<QName> supportedRelationList = new ArrayList<>();

public MemberPopupTabPanel(String id, List<RelationTypes> supportedRelationList){
public MemberPopupTabPanel(String id, List<QName> supportedRelationList){
super(id);
this.supportedRelationList = supportedRelationList;
}
Expand Down Expand Up @@ -83,17 +85,16 @@ public boolean isEnabled(){
});
parametersPanel.add(relationContainer);

DropDownChoicePanel<RelationTypes> relationSelector = new DropDownChoicePanel<RelationTypes> (ID_RELATION,
Model.of(getDefaultRelationValue()), Model.ofList(supportedRelationList),
WebComponentUtil.getEnumChoiceRenderer(MemberPopupTabPanel.this), false);
relationSelector.getBaseFormComponent().add(new EmptyOnChangeAjaxFormUpdatingBehavior());
relationSelector.setOutputMarkupId(true);
relationSelector.setOutputMarkupPlaceholderTag(true);
relationContainer.add(relationSelector);
}
relationContainer.add(new RelationDropDownChoicePanel(ID_RELATION, null, AreaCategoryType.ADMINISTRATION){
private static final long serialVersionUID = 1L;

@Override
protected List<QName> getChoicesList(){
return supportedRelationList;
}


private RelationTypes getDefaultRelationValue(){
return CollectionUtils.isNotEmpty(supportedRelationList) ? supportedRelationList.get(0) : RelationTypes.MEMBER;
});
}

protected ObjectDelta prepareDelta(){
Expand All @@ -119,15 +120,11 @@ protected ObjectDelta prepareDelta(){
protected abstract AbstractRoleType getAbstractRoleTypeObject();

public QName getRelationValue(){
DropDownChoicePanel<RelationTypes> relationPanel = getRelationDropDown();
RelationTypes relation = relationPanel.getModel().getObject();
if (relation == null) {
return SchemaConstants.ORG_DEFAULT;
}
return relation.getRelation();
RelationDropDownChoicePanel relationPanel = getRelationDropDown();
return relationPanel.getRelationValue();
}

private DropDownChoicePanel getRelationDropDown(){
return (DropDownChoicePanel)get(ID_RELATION_CONTAINER).get(ID_RELATION);
private RelationDropDownChoicePanel getRelationDropDown(){
return (RelationDropDownChoicePanel)get(ID_PARAMETERS_PANEL).get(ID_RELATION_CONTAINER).get(ID_RELATION);
}
}

0 comments on commit a9defae

Please sign in to comment.