summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Mishra2012-04-03 03:38:41 (EDT)
committer Manik Kishore2012-06-19 07:25:09 (EDT)
commit9af596232f69a1f8e05118f2922e1bc4ae0ae7da (patch)
tree463dd1815f5926a1d1ff904ea9a1e22c0b94b783
parent60935b444a4e23e6ddcdf870547366a5c32ade84 (diff)
downloadorg.eclipse.stardust.ui.web-9af596232f69a1f8e05118f2922e1bc4ae0ae7da.zip
org.eclipse.stardust.ui.web-9af596232f69a1f8e05118f2922e1bc4ae0ae7da.tar.gz
org.eclipse.stardust.ui.web-9af596232f69a1f8e05118f2922e1bc4ae0ae7da.tar.bz2
Jira-ID: CRNT-24383
excluded CasePerformer from AuthorizationManager views Participant Search git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ui.web@55214 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelUtils.java23
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java50
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/ParticipantHelper.java4
-rw-r--r--views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/PermissionPickList.java6
4 files changed, 54 insertions, 29 deletions
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelUtils.java
index c40d124..d8a2840 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ModelUtils.java
@@ -199,28 +199,7 @@ public class ModelUtils
return null;
}
- /**
- * method return only un-scoped model participants from all deployed models
- */
- public static List<Participant> getAllUnScopedModelParticipant()
- {
- Collection<Participant> allParticipants = ModelCache.findModelCache().getAllParticipants();
-
- // filter scoped roles/orgs
- List<Participant> participantList = CollectionUtils.newArrayList();
- for (Participant participant : allParticipants)
- {
- if (participant instanceof ModelParticipantInfo)
- {
- ModelParticipantInfo modelParticipant = (ModelParticipantInfo) participant;
- if (!modelParticipant.isDepartmentScoped())
- {
- participantList.add(participant);
- }
- }
- }
- return participantList;
- }
+
/**
* method returns Map of DataPath from all active models (exclude PredefinedModel)
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
index 30d9a10..fa808f2 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/utils/ParticipantUtils.java
@@ -444,6 +444,9 @@ public class ParticipantUtils
{
Collection<DeployedModel> allModels = ModelUtils.getAllModels();
List<QualifiedModelParticipantInfo> allParticipants = new ArrayList<QualifiedModelParticipantInfo>();
+
+ boolean isAdminAdded = false;
+
for (Model model : allModels)
{
if (filterPredefinedModel && PredefinedConstants.PREDEFINED_MODEL_ID.equals(model.getId()))
@@ -455,12 +458,57 @@ public class ParticipantUtils
{
if (participant instanceof QualifiedModelParticipantInfo)
{
- allParticipants.add((QualifiedModelParticipantInfo) participant);
+ boolean isAdminRole = isAdministratorRole(participant);
+
+ // Administrator should be add only once
+ if (!isAdminAdded && isAdminRole)
+ {
+ allParticipants.add((QualifiedModelParticipantInfo) participant);
+ isAdminAdded = true;
+ }
+ else if (!isAdminRole)
+ {
+ allParticipants.add((QualifiedModelParticipantInfo) participant);
+ }
}
}
}
return allParticipants;
}
+
+ public static boolean isAdministratorRole(Participant participant)
+ {
+ if (participant instanceof Role && PredefinedConstants.ADMINISTRATOR_ROLE.equals(participant.getId()))
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * method return only un-scoped model participants from all deployed models
+ */
+ public static List<Participant> getAllUnScopedModelParticipant(boolean filterPredefinedModel)
+ {
+ List<QualifiedModelParticipantInfo> allParticipants = getAllModelParticipants(filterPredefinedModel);
+
+ // filter scoped roles/orgs
+ List<Participant> participantList = CollectionUtils.newArrayList();
+ for (QualifiedModelParticipantInfo participant : allParticipants)
+ {
+ if (participant instanceof Participant)
+ {
+ ModelParticipantInfo modelParticipant = (ModelParticipantInfo) participant;
+ if (!modelParticipant.isDepartmentScoped())
+ {
+ participantList.add((Participant)participant);
+ }
+ }
+ }
+ return participantList;
+ }
+
/**
* return all model participants along with runtime participants
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/ParticipantHelper.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/ParticipantHelper.java
index 188b48a..cbef23f 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/ParticipantHelper.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/ParticipantHelper.java
@@ -50,7 +50,7 @@ import org.eclipse.stardust.ui.web.viewscommon.messages.MessagesViewsCommonBean;
import org.eclipse.stardust.ui.web.viewscommon.user.ParticipantAutocompleteSelector;
import org.eclipse.stardust.ui.web.viewscommon.user.ParticipantWrapper;
import org.eclipse.stardust.ui.web.viewscommon.utils.I18nUtils;
-import org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils;
+import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
import com.icesoft.faces.component.selectinputtext.SelectInputText;
@@ -374,7 +374,7 @@ public class ParticipantHelper implements IUserObjectBuilder<ParticipantTableEnt
*/
private List<Participant> findParticipantsByType(int typeFilter)
{
- List<Participant> participantList = ModelUtils.getAllUnScopedModelParticipant();
+ List<Participant> participantList = ParticipantUtils.getAllUnScopedModelParticipant(true);
List<Participant> filteredList = CollectionUtils.newArrayList();
diff --git a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/PermissionPickList.java b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/PermissionPickList.java
index 80f078f..5c41b03 100644
--- a/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/PermissionPickList.java
+++ b/views-common/src/main/java/org/eclipse/stardust/ui/web/viewscommon/views/authorization/PermissionPickList.java
@@ -11,7 +11,6 @@
package org.eclipse.stardust.ui.web.viewscommon.views.authorization;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -35,8 +34,7 @@ import org.eclipse.stardust.ui.web.viewscommon.user.ParticipantAutocompleteSelec
import org.eclipse.stardust.ui.web.viewscommon.user.ParticipantWrapper;
import org.eclipse.stardust.ui.web.viewscommon.utils.ExceptionHandler;
import org.eclipse.stardust.ui.web.viewscommon.utils.I18nUtils;
-import org.eclipse.stardust.ui.web.viewscommon.utils.ModelCache;
-import org.eclipse.stardust.ui.web.viewscommon.utils.ModelUtils;
+import org.eclipse.stardust.ui.web.viewscommon.utils.ParticipantUtils;
import com.icesoft.faces.component.selectinputtext.SelectInputText;
@@ -422,7 +420,7 @@ public class PermissionPickList
List<SelectItem> selectItems = new ArrayList<SelectItem>();
String regex = (!StringUtils.isEmpty(searchValue)) ? (searchValue.replaceAll("\\*", ".*") + ".*") : "";
- List<Participant> participantList=ModelUtils.getAllUnScopedModelParticipant();
+ List<Participant> participantList=ParticipantUtils.getAllUnScopedModelParticipant(true);
// Compile the pattern first as we are using this multiple times below in for
// loop