Skip to content

Commit

Permalink
Release 3.1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
zlamalp committed Oct 18, 2018
2 parents 2ba8ba7 + 8ae014a commit 0438f73
Show file tree
Hide file tree
Showing 27 changed files with 116 additions and 36 deletions.
2 changes: 1 addition & 1 deletion perun-auditer-exporter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-auditparser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ private void createAttributeDefinitions(String extSourceType, List<String> attrN
case "alternativeLoginName":
attr.setDisplayName("alternativeLoginName");
attr.setDescription("person's alternative login name in organization (not related to IdP identity).");
break;
// forwardedScopedAffiliation - is not standardized and published by the proxy itself, we do not
// set it back to the Perun (UES attribute), but we can read it (for registrar purpose).
case "dn":
Expand Down
2 changes: 1 addition & 1 deletion perun-cabinet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
10 changes: 8 additions & 2 deletions perun-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down Expand Up @@ -200,6 +200,12 @@
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -271,5 +277,5 @@
</profile>

</profiles>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
package cz.metacentrum.perun.core.impl.modules.attributes;

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.ExtSourcesManager;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException;
import cz.metacentrum.perun.core.impl.PerunSessionImpl;
import cz.metacentrum.perun.core.implApi.modules.attributes.UserVirtualAttributeCollectedFromUserExtSource;

/**
* All alternative logins of user collected from UserExtSources attributes
* as list of schacHomeOrganization:altLogin
*
* @author Pavel Zlámal <zlamal@cesnet.cz>
*/
@SuppressWarnings("unused")
public class urn_perun_user_attribute_def_virt_alternativeLoginNames extends UserVirtualAttributeCollectedFromUserExtSource {

@Override
public String getSourceAttributeFriendlyName() {
return "alternativeLoginName";
}

@Override
public String getDestinationAttributeFriendlyName() {
return "alternativeLoginNames";
}

@Override
public String getDestinationAttributeDisplayName() {
return "Alternative login names";
}

@Override
public String getDestinationAttributeDescription() {
return "List of all alternative logins of user in organizations represented as tuples of entityId:alternativeLogin";
}

@Override
public String modifyValue(PerunSession session, ModifyValueContext ctx, UserExtSource ues, String value) {

if (ues != null && ExtSourcesManager.EXTSOURCE_IDP.equals(ues.getExtSource().getType())) {
try {
Attribute schacAttribute = ((PerunSessionImpl)session).getPerunBl().getAttributesManagerBl().getAttribute(session, ues, AttributesManager.NS_UES_ATTR_DEF + ":schacHomeOrganization");
if (schacAttribute.getValue() != null) {
return schacAttribute.getValue() + ":" + value;
}
} catch (InternalErrorException |WrongAttributeAssignmentException | AttributeNotExistsException e) {
return null;
}
}

return null;

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cz.metacentrum.perun.core.impl.modules.attributes;

import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.implApi.modules.attributes.UserVirtualAttributeCollectedFromUserExtSource;
import org.apache.commons.lang3.StringUtils;

Expand Down Expand Up @@ -27,7 +29,7 @@ public String getDestinationAttributeDescription() {
}

@Override
public String modifyValue(ModifyValueContext ctx, String value) {
public String modifyValue(PerunSession session, ModifyValueContext ctx, UserExtSource ues, String value) {
if(value.endsWith("@orcid")) {
return "http://orcid.org/"+StringUtils.substringBefore(value,"@");
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ public class urn_perun_user_attribute_def_virt_groupNames extends UserVirtualAtt
private final static Logger log = LoggerFactory.getLogger(urn_perun_user_attribute_def_virt_groupNames.class);
private static final String FRIENDLY_NAME = "groupNames";

private Pattern memberAddedToPattern = Pattern.compile("Member:\\[(.*)] added to Group:\\[(.*)]");
private Pattern memberTotallyRemovedFromPattern = Pattern.compile("Member:\\[(.*)] was removed from Group:\\[(.*)] totally");
private Pattern memberAddedToPattern = Pattern.compile("Member:\\[(.*)\\] added to Group:\\[(.*)\\]", Pattern.DOTALL);
private Pattern memberTotallyRemovedFromPattern = Pattern.compile("Member:\\[(.*)\\] was removed from Group:\\[(.*)\\] totally", Pattern.DOTALL);



@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributeDefinition;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.InternalErrorException;
import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException;
Expand Down Expand Up @@ -87,7 +89,7 @@ protected DnsMapCtx initModifyValueContext(PerunSessionImpl sess, User user, Att
* Replaces DNS domain with country name, or null.
*/
@Override
public String modifyValue(DnsMapCtx ctx, String value) {
public String modifyValue(PerunSession session, DnsMapCtx ctx, UserExtSource ues, String value) {
Map<String, String> dnsMap = ctx.getDnsMap();
//find the longest matching key
int matchLength = 0;
Expand Down Expand Up @@ -136,8 +138,8 @@ public List<String> resolveVirtualAttributeValueChange(PerunSessionImpl sess, St
//find users that are affected by the change - have schacHomeOrganization value ending in key, but not ending with longerDomains
List<User> affectedUsers = sess.getPerunBl().getUsersManagerBl().findUsersWithExtSourceAttributeValueEnding(sess,getSourceAttributeName(),key,longerDomains);
for (User user : affectedUsers) {
Attribute thisAtribute = am.getAttribute(sess, user, getDestinationAttributeName());
messages.add(thisAtribute.serializeToString() + " set for " + user.serializeToString() + ".");
Attribute thisAttribute = am.getAttribute(sess, user, getDestinationAttributeName());
messages.add(thisAttribute.serializeToString() + " set for " + user.serializeToString() + ".");
}
}
return messages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cz.metacentrum.perun.core.api.Attribute;
import cz.metacentrum.perun.core.api.AttributeDefinition;
import cz.metacentrum.perun.core.api.AttributesManager;
import cz.metacentrum.perun.core.api.PerunSession;
import cz.metacentrum.perun.core.api.User;
import cz.metacentrum.perun.core.api.UserExtSource;
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException;
Expand Down Expand Up @@ -77,18 +78,20 @@ public String getDestinationAttributeDisplayName() {
}

public String getDestinationAttributeDescription() {
return "Collected values of userExtSource atribute " + getDestinationAttributeFriendlyName();
return "Collected values of userExtSource attribute " + getDestinationAttributeFriendlyName();
}

/**
* Override this method if you need to modify the original values. The default implementation makes no modification.
* Return null if the value should be skipped.
*
* @param session PerunSession
* @param ctx context initialized in initModifyValueContext method
* @param ues UserExtSource
* @param value of userExtSource attribute
* @return modified value or null to skip the value
*/
public String modifyValue(T ctx, String value) {
public String modifyValue(PerunSession session, T ctx, UserExtSource ues, String value) {
return value;
}

Expand Down Expand Up @@ -142,7 +145,7 @@ public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDe
//Apache mod_shib joins multiple values with ';', split them again
String[] rawValues = ((String) value).split(";");
//add non-null values returned by modifyValue()
Arrays.stream(rawValues).map(v -> modifyValue(ctx, v)).filter(Objects::nonNull).forEachOrdered(valuesWithoutDuplicities::add);
Arrays.stream(rawValues).map(v -> modifyValue(sess, ctx, userExtSource, v)).filter(Objects::nonNull).forEachOrdered(valuesWithoutDuplicities::add);
}
} catch (WrongAttributeAssignmentException | AttributeNotExistsException e) {
log.error("cannot read " + sourceAttributeFriendlyName + " from userExtSource " + userExtSource.getId() + " of user " + user.getId(), e);
Expand Down
2 changes: 1 addition & 1 deletion perun-dispatcher/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-ldapc-initializer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>cz.metacentrum</groupId>
<artifactId>perun</artifactId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-ldapc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public class EventProcessorImpl implements EventProcessor, Runnable {
//Groups patterns
private Pattern newGroupPattern = Pattern.compile(" created in Vo:\\[(.*)\\]", Pattern.DOTALL);
private Pattern subGroupPattern = Pattern.compile(" created in Vo:\\[(.*)\\] as subgroup of Group:\\[(.*)\\]", Pattern.DOTALL);
private Pattern assignGroupToResourcePattern = Pattern.compile("^Group:\\[(.*)\\] assigned to Resource:\\[(.*)\\]$", Pattern.DOTALL);
private Pattern removeGroupFromResourcePattern = Pattern.compile("^Group:\\[(.*)\\] removed from Resource:\\[(.*)\\]$", Pattern.DOTALL);
private Pattern assignGroupToResourcePattern = Pattern.compile("^Group:\\[(.*)\\] assigned to Resource:\\[(.*)\\]", Pattern.DOTALL);
private Pattern removeGroupFromResourcePattern = Pattern.compile("^Group:\\[(.*)\\] removed from Resource:\\[(.*)\\]", Pattern.DOTALL);
private Pattern moveGroupPattern = Pattern.compile("^Group:\\[(.*)\\] was moved\\.$", Pattern.DOTALL);
//Members patterns
private Pattern addedToPattern = Pattern.compile(" added to Group:\\[(.*)\\]", Pattern.DOTALL);
Expand All @@ -93,13 +93,13 @@ public class EventProcessorImpl implements EventProcessor, Runnable {

private Pattern userSetPattern = Pattern.compile(" set for User:\\[(.*)\\]", Pattern.DOTALL);
private Pattern userRemovePattern = Pattern.compile(" removed for User:\\[(.*)\\]", Pattern.DOTALL);
private Pattern userAllAttrsRemovedPattern = Pattern.compile("^All attributes removed for User:\\[(.*)\\]$", Pattern.DOTALL);
private Pattern userAllAttrsRemovedPattern = Pattern.compile("^All attributes removed for User:\\[(.*)\\]", Pattern.DOTALL);

private Pattern userUidNamespacePattern = Pattern.compile(cz.metacentrum.perun.core.api.AttributesManager.NS_USER_ATTR_DEF + ":uid-namespace:");
private Pattern userLoginNamespacePattern = Pattern.compile(cz.metacentrum.perun.core.api.AttributesManager.NS_USER_ATTR_DEF + ":login-namespace:");
//UserExtSources patterns
private Pattern addUserExtSourcePattern = Pattern.compile("^UserExtSource:\\[(.*)\\] added to User:\\[(.*)\\]$", Pattern.DOTALL);
private Pattern removeUserExtSourcePattern = Pattern.compile("^UserExtSource:\\[(.*)\\] removed from User:\\[(.*)\\]$", Pattern.DOTALL);
private Pattern addUserExtSourcePattern = Pattern.compile("^UserExtSource:\\[(.*)\\] added to User:\\[(.*)\\]", Pattern.DOTALL);
private Pattern removeUserExtSourcePattern = Pattern.compile("^UserExtSource:\\[(.*)\\] removed from User:\\[(.*)\\]", Pattern.DOTALL);

//CONSTANTS
private static final String LDAP_NAME = "ldap";
Expand Down
2 changes: 1 addition & 1 deletion perun-notification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-registrar-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-rpc-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-rpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-tasks-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public TaskResult getTaskResultById(int taskResultId, int engineID) {
" from tasks_results left join destinations on tasks_results.destination_id = destinations.id " +
" left join tasks on tasks.id = tasks_results.task_id" +
" left join services on services.id = tasks.service_id" +
"where tasks_results.id = ? and tasks_results.engine_id = ?",
" where tasks_results.id = ? and tasks_results.engine_id = ?",
TASKRESULT_ROWMAPPER, taskResultId, engineID);
}

Expand Down
2 changes: 1 addition & 1 deletion perun-voot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
2 changes: 1 addition & 1 deletion perun-web-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<artifactId>perun</artifactId>
<groupId>cz.metacentrum</groupId>
<version>3.1.8</version>
<version>3.1.9</version>
</parent>

<groupId>cz.metacentrum.perun</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void onValueChange(ValueChangeEvent<Boolean> valueChangeEvent) {
CellTable<Group> table = unions.getTable(new FieldUpdater<Group, String>() {
@Override
public void update(int arg0, Group group, String arg2) {
if (session.isGroupAdmin(group.getId()) || session.isVoAdmin(group.getId())) {
if (session.isGroupAdmin(group.getId()) || session.isVoAdmin(group.getVoId())) {
session.getTabManager().addTab(new GroupDetailTabItem(group.getId()));
} else {
UiElements.generateInfo("Not privileged", "You are not manager of selected group or its VO.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ public void onFinished(JavaScriptObject jso) {
vosBox.addAllItems(vos);

// get them
GetAllGroups getGroups = new GetAllGroups(voId, new JsonCallbackEvents(){
int backupVoId = voId;
if (vos.size() > 0) {
backupVoId = vos.get(0).getId();
}
GetAllGroups getGroups = new GetAllGroups(backupVoId, new JsonCallbackEvents(){
@Override
public void onFinished(JavaScriptObject jso) {
groupsBox.clear();
Expand Down Expand Up @@ -298,4 +302,4 @@ public boolean isAuthorized() {
}
}

}
}
Loading

0 comments on commit 0438f73

Please sign in to comment.