Skip to content

Commit

Permalink
Merge branch 'rkrutak/STR-1379/disabled_embedded_groups' into 'main'
Browse files Browse the repository at this point in the history
feat: disable groups user is already member of on embedded

See merge request perun/perun-idm/perun-wui!284
  • Loading branch information
kofzera committed Aug 26, 2024
2 parents eb314a7 + 4461dcf commit 7cd6331
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ public interface PerunRegistrarTranslation extends PerunTranslation {
@DefaultMessage("Enter value")
String enterValue();

@DefaultMessage("You are already a member of this group")
String alreadyMemberOfThisGroup();

// -------------- SUBMITTED APPS PAGE ------------------------ //

@DefaultMessage("Open applications")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@

/**
* Represents checkboxes for Group selection.
* Value is a list of group names and ids, separated by "#". Groups are separated by pipe '|'.
* It does not contain unchecked values.
*
* Value is a list of group names and ids along with optional ENABLED/DISABLED flag, separated by "#".
* Groups are separated by pipe '|'. It does not contain unchecked values.
* Example of a value:
* "Group A#124|Group B#1212|Group C#1212"
* "Group A#124#ENABLED|Group B#1212#DISABLED|Group C#1212#ENABLED"
*
* @author Vojtech Sassmann
*/
Expand All @@ -34,6 +33,16 @@ protected Widget initWidget() {
for (Widget widget : getWidget()) {
if (widget instanceof CheckBox) {
CheckBox checkBox = (CheckBox) widget;
// option appended with 'DISABLED' means that the user is already a member of that group
if (checkBox.getText().split("#").length > 1) {
String disabledFlag = checkBox.getText().split("#")[1];
checkBox.setText(checkBox.getText().split("#")[0]);
if (disabledFlag.equals("DISABLED")) {
checkBox.setEnabled(false);
checkBox.setTitle(translation.alreadyMemberOfThisGroup());
}
}

String[] parsedGroupName = checkBox.getText().split(Window.Location.getParameter("group") + ":");
// use group name without parent group prefix only if there is one
if (parsedGroupName[1] != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ addNewValue=Přidat hodnotu
removeValue=Odstranit hodnotu
enterKey=Zadejte nový klíč
enterValue=Zadejte hodnotu
alreadyMemberOfThisGroup=Jste již členem této skupiny

# // -------------- SUBMITTED APPS PAGE ------------------------ //

Expand Down

0 comments on commit 7cd6331

Please sign in to comment.