Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r149 - trunk/java/ch/idok/qtgui

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r149 - trunk/java/ch/idok/qtgui


Chronological Thread 
  • From: "Apache" <apache AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r149 - trunk/java/ch/idok/qtgui
  • Date: Mon, 21 Jul 2008 13:41:05 +0200
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: huebner AT PSI.CH
Date: Mon Jul 21 13:41:05 2008
New Revision: 149

Log:
Added LDAP support for the "Add User to Group" and "Add Group to Group" menu

Modified:
trunk/java/ch/idok/qtgui/AuthorizationController.java

Modified: trunk/java/ch/idok/qtgui/AuthorizationController.java
==============================================================================
--- trunk/java/ch/idok/qtgui/AuthorizationController.java (original)
+++ trunk/java/ch/idok/qtgui/AuthorizationController.java Mon Jul 21
13:41:05 2008
@@ -272,8 +272,8 @@
actionA.triggered.connect(this, "removeUserFromACL()");
QAction actionB = new QAction("Remove this group", asd_);
actionB.triggered.connect(this, "removeGroupFromACL()");
- QAction actionC = new QAction("Add user or group", asd_);
- actionC.triggered.connect(this, "addPrincipalToGroup()");
+// QAction actionC = new QAction("Add user or group", asd_);
+// actionC.triggered.connect(this, "addPrincipalToGroup()");
QAction actionD = new QAction("Remove from group", asd_);
actionD.triggered.connect(this, "removeUserFromGroup()");
QAction actionE = new QAction("Remove from parent group", asd_);
@@ -284,17 +284,22 @@
actionG.triggered.connect(this, "addGroupToACL()");
QAction actionH = new QAction("Create new group", asd_);
actionH.triggered.connect(this, "createNewGroup()");
- QAction actionI = new QAction("Create new group from Ldap", asd_);
+ QAction actionI = new QAction("Create new group from LDAP", asd_);
actionI.triggered.connect(this, "createNewLdapGroup()");
QAction actionJ = new QAction("Delete group and users", asd_);
actionJ.triggered.connect(this, "removeGroupAndUsers()");
+ QAction actionK = new QAction("Add user", asd_);
+ actionK.triggered.connect(this, "addUserToGroup()");
+ QAction actionL = new QAction("Add Group", asd_);
+ actionL.triggered.connect(this, "addGroupToGroup()");

topLevelUserMenu_ = new QMenu(asd_);
topLevelUserMenu_.addAction(actionA);

topLevelGroupMenu_ = new QMenu(asd_);
topLevelGroupMenu_.addAction(actionB);
- topLevelGroupMenu_.addAction(actionC);
+ topLevelGroupMenu_.addAction(actionK);
+ topLevelGroupMenu_.addAction(actionL);
topLevelGroupMenu_.addAction(actionJ);

userWithinGroupMenu_ = new QMenu(asd_);
@@ -302,7 +307,8 @@

groupWithinGroupMenu_ = new QMenu(asd_);
groupWithinGroupMenu_.addAction(actionE);
- groupWithinGroupMenu_.addAction(actionC);
+ groupWithinGroupMenu_.addAction(actionK);
+ groupWithinGroupMenu_.addAction(actionL);

emptySpaceMenu_ = new QMenu(asd_);
emptySpaceMenu_.addAction(actionF);
@@ -520,6 +526,69 @@
}

}
+
+ private final void addUserToGroup() {
+ String groupName = selectedItem_.text(0);
+ String principal = askForAuto(String.format(
+ tr("Enter name of user to add to group %1$s"),
+ groupName));
+ if (principal == null)
+ return;
+ try {
+ ServiceProvider.getInstance().getAdminService().addToGroup(
+ GuiClientHandler.getInstance().getCredentials(),
principal,
+ groupName);
+ defineAccessRights();
+ } catch (DmsException e) {
+ QMessageBox.warning(null, tr("iDok Warning"), String.format(
+ tr("Unable to add principal to group \n %1$s"), e
+ .getLogMessage()));
+ asd_.raise();
+ }
+
+ }
+
+
+ private final void addGroupToGroup() {
+ String groupName = selectedItem_.text(0);
+
+ List<String> choices = new ArrayList<String>();
+ try {
+ // create drop down box with list of available groups
+ AdminService.QueryMatch[] members = ServiceProvider.getInstance()
+ .getAdminService().queryGroupMembers(
+ GuiClientHandler.getInstance().getCredentials(),
+ "", "");
+ for (int j = 0; j < members.length; ++j) {
+ if (!choices.contains(members[j].getTask())) {
+ choices.add(members[j].getTask());
+ }
+ }
+ choices.add(AnybodyDmsCredentials.anybodyGroup);
+ } catch (DmsException e) {
+ QMessageBox.warning(null, tr("iDok Warning"), String.format(
+ tr("Unable to retrieve list of available groups \n
%1$s"),
+ e.getLogMessage()));
+ asd_.raise();
+ }
+
+ String principal = askForChoice(String.format(
+ tr("Enter name of group to add to group %1$s"),groupName),
choices);
+ if (principal == null)
+ return;
+ try {
+ ServiceProvider.getInstance().getAdminService().addToGroup(
+ GuiClientHandler.getInstance().getCredentials(),
principal,
+ groupName);
+ defineAccessRights();
+ } catch (DmsException e) {
+ QMessageBox.warning(null, tr("iDok Warning"), String.format(
+ tr("Unable to add principal to group \n %1$s"), e
+ .getLogMessage()));
+ asd_.raise();
+ }
+
+ }

private final void removeUserFromGroup() {
String principal = selectedItem_.text(0);



  • [idok-commit] idok commit r149 - trunk/java/ch/idok/qtgui, Apache, 07/21/2008

Archive powered by MHonArc 2.6.19.

Top of Page