Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Mar 10, 2023
2 parents a38648b + c13cf9f commit c01a8da
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ public void validate(IValidatable<String> validatable) {
}

private boolean hintEqualsOrSimilarToPassword(@NotNull String password, @NotNull String hint) {
return password.equals(hint) || password.contains(hint.trim().replaceAll(" ", ""))
|| hint.contains(password);
String passwordWithoutSpacesValue = password.trim().replaceAll(" ", "");
String hintWithoutSpacesValue = hint.trim().replaceAll(" ", "");
return passwordWithoutSpacesValue.contains(hintWithoutSpacesValue)
|| hintWithoutSpacesValue.contains(passwordWithoutSpacesValue);
}
}

Expand Down
9 changes: 8 additions & 1 deletion gui/admin-gui/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ module.exports = {
},
},
'./node_modules/postcss-loader',
'./node_modules/sass-loader',
{
loader: "./node_modules/sass-loader",
options: {
sassOptions: {
outputStyle: "expanded",
}
},
},
],
},
{
Expand Down
4 changes: 0 additions & 4 deletions gui/admin-gui/webpack.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: 'production',
plugins: [
// Extracts CSS into separate files
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
Expand All @@ -20,9 +19,6 @@ module.exports = {
optimization: {
minimize: true,
minimizer: [new CssMinimizerPlugin(), '...'],
// runtimeChunk: {
// name: 'runtime',
// },
},
performance: {
hints: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,11 @@ public AssignmentPathSegmentType toAssignmentPathSegmentType(boolean includeAssi
}
rv.setAssignmentId(assignment.getId());
if (source != null) {
rv.setSourceRef(ObjectTypeUtil.createObjectRef(source, getPrismContext()));
rv.setSourceRef(ObjectTypeUtil.createObjectRef(source));
rv.setSourceDisplayName(ObjectTypeUtil.getDisplayName(source));
}
if (target != null) {
rv.setTargetRef(ObjectTypeUtil.createObjectRef(target, getPrismContext()));
rv.setTargetRef(ObjectTypeUtil.createObjectRef(target, relation));
rv.setTargetDisplayName(ObjectTypeUtil.getDisplayName(target));
}
rv.setMatchingOrder(isMatchingOrder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import javax.xml.namespace.QName;

import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
Expand Down Expand Up @@ -219,6 +221,48 @@ public void test400AddingOneAssignmentFromUser() throws Exception {
new ExpectedAssignmentPath(ts -> ts > afterAddTs, businessRole1bOid, appRole1bOid));
}

@Test
public void test500AddUserWithAssignmentToRoleNonDefaultRelation() throws Exception {
Task task = getTestTask();
OperationResult result = task.getResult();

given("new user with assignment to a role with different relation");
UserType user = new UserType()
.name("user-" + getTestNumber())
.assignment(new AssignmentType().targetRef(
createObjectReference(appRole1Oid, RoleType.COMPLEX_TYPE, SchemaConstants.ORG_MANAGER)));

when("user is added");
String userOid = addObject(user, task, result);

then("roleMembershipRefs contain value metadata with accesses information");
UserAsserter<Void> userAsserter = assertUser(userOid, "after")
.displayXml() // XML also shows the metadata
.assertRoleMembershipRefs(2); // details are not interesting for this test

and("first segments have targetRef with manager relation");
segmentsHaveExpectedRelations(userAsserter, appRole1Oid,
SchemaConstants.ORG_MANAGER);
segmentsHaveExpectedRelations(userAsserter, appService1Oid,
SchemaConstants.ORG_MANAGER, SchemaConstants.ORG_DEFAULT);
}

private void segmentsHaveExpectedRelations(
UserAsserter<Void> userAsserter, String membershipTargetOid, QName... expectedRelations)
throws SchemaException {
ValueMetadataType metadata = (ValueMetadataType) userAsserter
.valueMetadata(F_ROLE_MEMBERSHIP_REF, ValueSelector.refEquals(membershipTargetOid))
.assertSize(1)
.getRealValue();
List<AssignmentPathSegmentMetadataType> segments = metadata.getProvenance().getAssignmentPath().getSegment();
assertThat(segments).hasSameSizeAs(expectedRelations);
for (int i = 0; i < expectedRelations.length; i++) {
assertThat(segments.get(i).getTargetRef().getRelation())
.describedAs("segment #%d for role membership ref to %s", i, membershipTargetOid)
.isEqualTo(expectedRelations[i]);
}
}

@Test
public void test900AccessesMetadataAreOnByDefault() throws Exception {
Task task = getTestTask();
Expand Down Expand Up @@ -326,11 +370,9 @@ private void assertNoRoleMembershipRefMetadata(String userOid, String... roleMem
private void assertAssignmentPath(UserAsserter<Void> userAsserter,
String roleMembershipTargetOid, ExpectedAssignmentPath... expectedAssignmentPaths)
throws SchemaException {
userAsserter.valueMetadata(F_ROLE_MEMBERSHIP_REF, ValueSelector.refEquals(roleMembershipTargetOid))
.assertSize(expectedAssignmentPaths.length);

Collection<ValueMetadataType> metadataValues = userAsserter
.valueMetadata(F_ROLE_MEMBERSHIP_REF, ValueSelector.refEquals(roleMembershipTargetOid))
.assertSize(expectedAssignmentPaths.length)
.getRealValues();
userAsserter.end(); // to fix the state of asserter back after valueMetadata() call
var listAsserter = assertThat(metadataValues)
Expand Down

0 comments on commit c01a8da

Please sign in to comment.