Skip to content

Commit

Permalink
SAK-46555 Text descriptions for Sign-up permissions view are not defi…
Browse files Browse the repository at this point in the history
  • Loading branch information
josecebe authored Nov 26, 2021
1 parent ac3a169 commit f89a8f3
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 2 deletions.
13 changes: 13 additions & 0 deletions signup/tool/src/bundle/permissions.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
desc-signup.update.group.all=Update or edit events for any group
desc-signup.view.all=View any event and its groups
desc-signup.update.group=Update or edit events of the own group(s)
desc-signup.update.site=Update or edit any site-wide event
desc-signup.delete.site=Delete any site-wide event
desc-signup.create.group.all=Create events for any groups in the site
desc-signup.view=View group level events or site level events if they are members of them
desc-signup.attend.all=Attend any event and its groups
desc-signup.create.site=Create events open to all site participants
desc-signup.attend=Attend group level event and site level event if they are member of them
desc-signup.create.group=Create events for the own group(s)
desc-signup.delete.group=Delete any event of the own group(s)
desc-signup.delete.group.all=Delete any group event
13 changes: 13 additions & 0 deletions signup/tool/src/bundle/permissions_ca.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
desc-signup.update.group.all=Actualitzar o editar esdeveniments de qualsevol grup
desc-signup.view.all=Visualitzar qualsevol esdeveniment i els seus grups
desc-signup.update.group=Actualitzar o editar esdeveniments dels teus grups
desc-signup.update.site=Actualitzar o editar qualsevol esdeveniment del lloc
desc-signup.delete.site=Eliminar qualsevol esdeveniment del lloc
desc-signup.create.group.all=Crear esdeveniments per a qualsevol grup del lloc
desc-signup.view=Visualitzar esdeveniments en l'\u00E0mbit del lloc o grup se n'\u00E9s membre
desc-signup.attend.all=Assistir a qualsevol esdeveniment i els seus grups
desc-signup.create.site=Crear esdeveniments per a qualsevol participant del lloc
desc-signup.attend=Assistir a un esdeveniment en l'\u00E0mbit del lloc o grup se n'\u00E9s membre
desc-signup.create.group=Crear esdeveniments per als teus grups
desc-signup.delete.group=Eliminar qualsevol esdeveniment dels teus grups
desc-signup.delete.group.all=Eliminar esdeveniments de qualsevol grup
13 changes: 13 additions & 0 deletions signup/tool/src/bundle/permissions_es.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
desc-signup.update.group.all=Actualizar o editar eventos de cualquier grupo
desc-signup.view.all=Visualizar cualquier evento y sus grupos
desc-signup.update.group=Actualizar o editar eventos de tus grupos
desc-signup.update.site=Actualizar o editar cualquier evento del sitio
desc-signup.delete.site=Eliminar cualquier evento del sitio
desc-signup.create.group.all=Crear eventos para cualquier grupo del sitio
desc-signup.view=Visualizar eventos a nivel del sitio o grupo si se es miembro del mismo
desc-signup.attend.all=Asistir a cualquier evento y sus grupos
desc-signup.create.site=Crear eventos para todos los participantes del sitio
desc-signup.attend=Asistir a un evento a nivel de grupo y sitio si se es miembro del mismo
desc-signup.create.group=Crear eventos para tus grupos
desc-signup.delete.group=Eliminar cualquier evento de tus grupos
desc-signup.delete.group.all=Eliminar eventos de cualquier grupo
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@
package org.sakaiproject.signup.tool.jsf;

import java.text.MessageFormat;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;

import javax.faces.component.UIData;
import javax.faces.context.ExternalContext;
Expand Down Expand Up @@ -107,19 +112,25 @@ public String updatePermission() {
params = new Object[] { realmItem.getSiteTitle(), realmItem.getGroupTitle(), realmItem.getRefId() };
desc = MessageFormat.format(Utilities.rb.getString("permission.info.for.group.scope"), params);
}
HashMap<String, String> permissionDescriptions = new HashMap<>();
Utilities.rbPerm.entrySet().stream().forEach(obj -> {
Entry entry = (Entry) obj;
permissionDescriptions.put(entry.getKey().toString(), entry.getValue().toString());
});

return doPermissions(realmItem.getRefId(), desc);
return doPermissions(realmItem.getRefId(), desc, permissionDescriptions);
}

/**
* Delegate the permission update job to sakai-permissions-helper tool
*/
private String doPermissions(String siteRef, String description) {
private String doPermissions(String siteRef, String description, HashMap<String, String> permissionDescriptions) {
try {
ToolSession currentToolSession = SessionManager.getCurrentToolSession();
currentToolSession.setAttribute(PermissionsHelper.PREFIX, "signup.");
currentToolSession.setAttribute(PermissionsHelper.TARGET_REF, siteRef);
currentToolSession.setAttribute(PermissionsHelper.DESCRIPTION, description);
currentToolSession.setAttribute(PermissionsHelper.PERMISSION_DESCRIPTION, permissionDescriptions);
ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
context.redirect("sakai.permissions.helper.helper/tool");
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ public final class Utilities implements SignupBeanConstants, MeetingTypes {
* Get the resource bundle for messages.properties file
*/
public static ResourceLoader rb = new ResourceLoader("messages");

/**
* Get the resource bundle for messages.properties file
*/
public static ResourceLoader rbPerm = new ResourceLoader("permissions");

/**
* Get the resource bundle for signupConfig.properties file
Expand Down

0 comments on commit f89a8f3

Please sign in to comment.