Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-3.6' into support-3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Aug 7, 2017
2 parents 09c7668 + d3caa21 commit 8ef5c11
Show file tree
Hide file tree
Showing 45 changed files with 1,461 additions and 162 deletions.
Expand Up @@ -1711,11 +1711,11 @@ private MainMenuItem createServicesItems() {
return item;
}

public PrismObject<UserType> loadUserSelf(PageBase page) {
public PrismObject<UserType> loadUserSelf() {
Task task = createSimpleTask(OPERATION_LOAD_USER);
OperationResult result = task.getResult();
PrismObject<UserType> user = WebModelServiceUtils.loadObject(UserType.class,
WebModelServiceUtils.getLoggedInUserOid(), page, task, result);
WebModelServiceUtils.getLoggedInUserOid(), PageBase.this, task, result);
result.computeStatus();

showResult(result, null, false);
Expand Down Expand Up @@ -1871,7 +1871,7 @@ public void redirectBackToBreadcrumb(Breadcrumb breadcrumb) {
}

protected void setTimeZone(PageBase page){
PrismObject<UserType> user = loadUserSelf(page);
PrismObject<UserType> user = loadUserSelf();
String timeZone = null;
MidPointPrincipal principal = SecurityUtils.getPrincipalUser();
if (user != null && user.asObjectable().getTimezone() != null){
Expand Down
Expand Up @@ -340,7 +340,7 @@ public Search load() {
return search;
}
};
selfUser = pageBase.loadUserSelf(pageBase);
selfUser = pageBase.loadUserSelf();
}

private void initUserSelectionPanel(WebMarkupContainer headerPanel){
Expand Down Expand Up @@ -616,7 +616,7 @@ private boolean isAlreadyAssigned(PrismObject<AbstractRoleType> obj, AssignmentE

private PrismObject<UserType> getTargetUser(){
if (getRoleCatalogStorage().isSelfRequest()){
return selfUser == null ? pageBase.loadUserSelf(pageBase) : selfUser;
return selfUser == null ? pageBase.loadUserSelf() : selfUser;
}
return getRoleCatalogStorage().getTargetUserList().get(0);
}
Expand Down
Expand Up @@ -51,10 +51,14 @@
import com.evolveum.midpoint.web.component.input.DropDownChoicePanel;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
import com.evolveum.midpoint.web.page.admin.PageAdminObjectDetails;
import com.evolveum.midpoint.web.page.admin.configuration.component.ChooseTypePanel;
import com.evolveum.midpoint.web.page.admin.dto.ObjectViewDto;
import com.evolveum.midpoint.web.page.admin.users.component.AssignmentsPreviewDto;
import com.evolveum.midpoint.web.page.admin.users.dto.UserDtoStatus;
import com.evolveum.midpoint.web.page.self.PageAssignmentDetails;
import com.evolveum.midpoint.web.page.self.PageAssignmentsList;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.prism.xml.ns._public.types_3.ItemPathType;

Expand Down Expand Up @@ -1144,12 +1148,20 @@ private ItemSecurityDecisions loadSecurityDecisions(){
if (pageBase == null || getModelObject().getTargetRef() == null){
return null;
}
PrismObject<UserType> user = null;
List<PrismObject<UserType>> targetUserList = pageBase.getSessionStorage().getRoleCatalog().getTargetUserList();
if (targetUserList == null || targetUserList.size() == 0){
user = pageBase.loadUserSelf(pageBase);
} else {
user = targetUserList.get(0);
PrismObject<? extends FocusType> operationObject = null;
if (pageBase instanceof PageAdminFocus){
operationObject = ((PageAdminFocus)pageBase).getObjectWrapper().getObject();
} else if ((pageBase instanceof PageAssignmentDetails || pageBase instanceof PageAssignmentsList) //shopping cart assignment details panels
&& !pageBase.getSessionStorage().getRoleCatalog().isMultiUserRequest()){
List<PrismObject<UserType>> targetUserList = pageBase.getSessionStorage().getRoleCatalog().getTargetUserList();
if (targetUserList == null || targetUserList.size() == 0){
operationObject = pageBase.loadUserSelf();
} else {
operationObject = targetUserList.get(0);
}
}
if (operationObject == null){
return null;
}
String targetObjectOid = getModelObject().getTargetRef().getOid();

Expand All @@ -1160,7 +1172,7 @@ private ItemSecurityDecisions loadSecurityDecisions(){
ItemSecurityDecisions decisions = null;
try{
decisions =
pageBase.getModelInteractionService().getAllowedRequestAssignmentItems(user, targetRefObject);
pageBase.getModelInteractionService().getAllowedRequestAssignmentItems(operationObject, targetRefObject);

} catch (SchemaException|SecurityViolationException ex){
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load security decisions for assignment items.", ex);
Expand Down
Expand Up @@ -81,7 +81,7 @@ public class PageDashboard extends PageAdminHome {
private final Model<PrismObject<UserType>> principalModel = new Model<PrismObject<UserType>>();

public PageDashboard() {
principalModel.setObject(loadUserSelf(PageDashboard.this));
principalModel.setObject(loadUserSelf());
setTimeZone(PageDashboard.this);
initLayout();
}
Expand Down
Expand Up @@ -498,7 +498,7 @@ private ObjectQuery getTaskQuery(){
List<PrismObject<UserType>> userList = getSessionStorage().getRoleCatalog().getTargetUserList();
if (getSessionStorage().getRoleCatalog().isSelfRequest()){
userList = new ArrayList<>();
userList.add(loadUserSelf(PageAssignmentsList.this));
userList.add(loadUserSelf());
}
Set<String> oids = new HashSet<>();
for (PrismObject<UserType> user : userList){
Expand Down Expand Up @@ -559,7 +559,7 @@ private TextArea getDescriptionComponent(){
private PrismObject<UserType> getTargetUser() throws SchemaException {
List<PrismObject<UserType>> usersList = getSessionStorage().getRoleCatalog().getTargetUserList();
PrismObject<UserType> user = getSessionStorage().getRoleCatalog().isSelfRequest() ?
loadUserSelf(PageAssignmentsList.this) : usersList.get(0);
loadUserSelf() : usersList.get(0);
getPrismContext().adopt(user);
return user;
}
Expand Down
Expand Up @@ -115,6 +115,8 @@ public class DummyConnector implements PoolableConnector, AuthenticateOp, Resolv

private DummyResource resource;

private boolean connected = false;

private static String staticVal;

/**
Expand Down Expand Up @@ -166,6 +168,11 @@ public void init(Configuration configuration) {
}
resource.setMonsterization(this.configuration.isMonsterized());

if (connected) {
throw new IllegalStateException("Double connect in "+this);
}
connected = true;

resource.connect();

if (staticVal == null) {
Expand All @@ -181,13 +188,16 @@ public void init(Configuration configuration) {
* @see Connector#dispose()
*/
public void dispose() {
connected = false;
resource.disconnect();
log.info("Disconnected from dummy resource instance {0} ({1} connections still open)", resource, resource.getConnectionCount());
}

@Override
public void checkAlive() {
// notthig to do. always alive.
if (!connected) {
throw new IllegalStateException("checkAlive on non-connected connector instance "+this);
}
}

/******************
Expand Down Expand Up @@ -1591,6 +1601,11 @@ public SyncToken getLatestSyncToken(ObjectClass objectClass) {
*/
public void test() {
log.info("test::begin");

if (!connected) {
throw new IllegalStateException("Attempt to test non-connected connector instance "+this);
}

log.info("Validating configuration.");
configuration.validate();

Expand Down
Expand Up @@ -203,6 +203,16 @@ public static List<SchemaDescription> parseWsdlResource(final String resourcePat
}
}

public static SchemaDescription parseInputStream(final InputStream input, String description) throws SchemaException {
if (input == null) {
throw new NullPointerException("Input stream must not be null");
}
SchemaDescription desc = new SchemaDescription("inputStream " + description);
desc.path = null;
desc.streamable = () -> input;
desc.parseFromInputStream();
return desc;
}

public static SchemaDescription parseFile(final File file) throws FileNotFoundException, SchemaException {
SchemaDescription desc = new SchemaDescription("file "+file.getPath());
Expand Down
Expand Up @@ -18,6 +18,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -256,6 +257,10 @@ public void registerPrismSchemaFile(File file) throws FileNotFoundException, Sch
loadPrismSchemaFileDescription(file);
}

public void registerPrismSchema(InputStream input, String sourceDescription) throws SchemaException {
loadPrismSchemaDescription(input, sourceDescription);
}

public SchemaDescription loadPrismSchemaFileDescription(File file) throws FileNotFoundException, SchemaException {
if (!(file.getName().matches(".*\\.xsd$"))){
LOGGER.trace("Skipping registering {}, because it is not schema definition.", file.getAbsolutePath());
Expand All @@ -267,6 +272,14 @@ public SchemaDescription loadPrismSchemaFileDescription(File file) throws FileNo
return desc;
}

public SchemaDescription loadPrismSchemaDescription(InputStream input, String sourceDescription)
throws SchemaException {
SchemaDescription desc = SchemaDescription.parseInputStream(input, sourceDescription);
desc.setPrismSchema(true);
registerSchemaDescription(desc);
return desc;
}

private void registerSchemaDescription(SchemaDescription desc) {
if (desc.getUsualPrefix() != null) {
namespacePrefixMapper.registerPrefix(desc.getNamespace(), desc.getUsualPrefix(), desc.isDefault());
Expand Down
12 changes: 12 additions & 0 deletions infra/prism/src/main/resources/xml/ns/public/annotation-3.xsd
Expand Up @@ -220,6 +220,18 @@
<xsd:annotation>
<xsd:documentation>
Marks deprecated parts of the schema.
Deprecated parts are supposed to work, but their use is discouraged.
Deprecated functionality may be removed in any future release.
</xsd:documentation>
</xsd:annotation>
</xsd:element>

<xsd:element name="experimental" type="xsd:boolean">
<xsd:annotation>
<xsd:documentation>
Marks experimental functionality.
Experimental functionality is not stable and it may be changed in any
future release without any warning. Use at your own risk.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
Expand Down
Expand Up @@ -4432,6 +4432,22 @@
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="useProposedShadows" type="xsd:boolean" minOccurs="0" default="false">
<xsd:annotation>
<xsd:documentation>
If set to true then midPoint will try to create shadows in "proposed" lifecycle
state even before an operation is executed. The proposed shadows may be used
in combination with shadowConstraintsCheck to reduce probability of identifier
conflicts for resources with slow create/rename operations.

This feature is EXPERIMENTAL. Use with care.
</xsd:documentation>
<xsd:appinfo>
<a:since>3.6.1</a:since>
<a:experimental>true</a:experimental>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="validateSchema" type="xsd:boolean" minOccurs="0" default="false">
<xsd:annotation>
<xsd:documentation>
Expand Down
Expand Up @@ -570,6 +570,9 @@
(Can be overriden at the level of individual attributes via readReplaceMode property.)

BEWARE: READ+REPLACE is currently supported for attributes only - not for subjectToObject associations.

TODO: This should really be an option of the Update capability, not a capability on its own.
TODO: also unify with delta update capability.
</xsd:documentation>
</xsd:annotation>
<xsd:complexContent>
Expand Down

0 comments on commit 8ef5c11

Please sign in to comment.