Skip to main content
Skip table of contents

isSessionUserInGroup

Versionshinweise

24.1, 23.3.07

Code

GROOVY
boolean isSessionUserInGroup(String groupPk)

Beschreibung

Prüft, ob der Benutzer der aktuellen Session der Gruppe angehört, deren Pk übergeben wurde.

Parameter

  • groupPk - Der Primärschlüssel der zu prüfenden Gruppe.

Rückgabe

  • true wenn der Benutzer der aktuellen Session dieser Gruppe angehört
    false sonst

Beispiele

GROOVY
ISearchCondition activeCond = SearchUtils.createSearchCondition("Active.Groups", SearchUtils.EQUAL, true);
ISearchCondition pkCond = SearchUtils.createSearchCondition("Pk.Groups", SearchUtils.NO_CONDITION);
ISearchCondition groupNameCond = SearchUtils.createSearchCondition("GroupName.Groups", SearchUtils.NO_CONDITION);
 
ISearch groupSearch = SearchUtils.createSearch("Groups", activeCond);
groupSearch = SearchUtils.addSearchCondition(groupSearch, pkCond);
groupSearch = SearchUtils.addSearchCondition(groupSearch, groupNameCond);
 
String msg = "User " + SessionConstants.USER;
List<IContainer> allGroups = WorkSpaceScriptUtils.searchForRead(groupSearch);
for (IContainer group : allGroups)
{
  String groupName = WorkSpaceScriptUtils.getValue(group, "GroupName.Groups");
  String groupPk = WorkSpaceScriptUtils.getValue(group, "Pk.Groups");
  msg += "\n" + "Group " + groupName + ": " + RightUtils.isSessionUserInGroup(groupPk);
}
ScriptUtils.error(msg);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.