on 04-27-2006 2:20 PM
Hello,
I need to fetch all the available pcd roles in EP. Right now I am trying to fetch pcd roles under Portal Content directory. I need a clarification whether this is the only place the pcd roles are available or is there any other location where rest of the pcd roles are available?
Thanks in advance,
Prashanth V Swamy
Hi Prashanth,
We will get roles from two places. From PCD and another is LDAP. If you want to get PCD rooles search with RoleSearchFilters and Enumerate.
Just have a look this example
IRoleFactory iRoleF = UMFactory.getRoleFactory();
IRoleSearchFilter roleFlt = iRoleF.getRoleSearchFilter();
roleFlt.setUniqueName("*",ISearchAttribute.EQUALS_OPERATOR,false);
ISearchResult rslt1 = iRoleF.searchRoles(roleFlt);
if ( rslt1.getState() == ISearchResult.SEARCH_RESULT_OK ){
while (rslt1.hasNext()){
String roleUid = rslt1.next().toString();
...........
}
}
Best Regards,
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Just a small but useful addition in the code posted by Rahasekhar. In order to get the IRole object from the ISearchResult, you can use the following code:
ISearchResult rslt1 = iRoleF.searchRoles(roleFlt);
if ( rslt1.getState() == ISearchResult.SEARCH_RESULT_OK )
{
while (rslt1.hasNext())
{
<b>String roleUid = (String)rslt1.next();
IRole r = UMFactory.getRoleFactory().getRole(roleUid);</b>}
}
Now we can access all the usual methods available on the IRole object r.
Best Regards,
Vivek
Hi ,
You need the following jars in order to get PCD contents.
1.com.sap.portal.pcd.glservice_api.jar
2.com.sap.portal.pcm.admin.apiservice_api.jar
3.com.sap.portal.ivs.api_portalpcm_api.jar
4.gl_api.jar
5.prtapi.jar
6.concurrency.jar
7.com.sap.portal.ivs.api_landscape_api.jar
Thanks and Regards
Radhika Kuthiala
Hi Prasanth,
See the code below to retrieve all the pcd roles.
public List getPCDContents(IPortalComponentRequest request) throws Exception{
try{
Hashtable env = new Hashtable();
env.put(IPcdContext.SECURITY_PRINCIPAL, request.getUser());
env.put(Context.INITIAL_CONTEXT_FACTORY,IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(com.sap.portal.directory.Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext ctx = null;
DirContext dirCtx;
List roleList = null;
ctx = new InitialContext(env);
dirCtx = (DirContext) ctx.lookup("pcd:portal_content/");
PcdSearchControls pcdSearchControls = new PcdSearchControls();
pcdSearchControls.setReturningObjFlag(false);
pcdSearchControls.setSearchScope(
PcdSearchControls.SUBTREE_WITH_UNIT_ROOTS_SCOPE);
dirCtx.addToEnvironment(
Constants.APPLY_ASPECT_TO_CONTEXTS,
Constants.APPLY_ASPECT_TO_CONTEXTS);
NamingEnumeration ne =
dirCtx.search("","(com.sap.portal.pcd.gl.ObjectClass=com.sapportals.portal.role)",
pcdSearchControls);
iViewList = new ArrayList();
while (ne.hasMoreElements()) {
IPcdSearchResult searchResult =
(IPcdSearchResult) ne.nextElement();
String location = "pcd:portal_content/" + searchResult.getName();
//Get the full pcd path of the iview.
roleList.add(location);
}
return iViewList;
}catch(Exception e ){
throw new Exception(e);
}
}
Hope it helps.
Regards,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Im not sure if i've got this right. But if you go to User Administration > Roles and then select 'roles' from the drop down list and click start, all the roles will be displayed.
Hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prashanth,
As of I know all the PCD Roles created in EP will be stored under PCD and not somewhere else.
As you are retrieving all the roles from PCD its enough and no need to get confused.
Regards,
Karthick Eswaran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.