cancel
Showing results for 
Search instead for 
Did you mean: 

Retreiving Information about number of users and roles, worksets in Portal

Former Member
0 Kudos
55

hi All,

Can anyone help me out regarding a program that is to be made in Webdynpro, so that it cancount the number of users, roles, and worksets present in An Enetrprise Portal

Regards,

Shailesh Nagar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Shailesh,

You can use the interfaces in <b>com.sap.security.api</b> package. There are interfaces like IUser, IGroup, IRole. There are lot of methods in it to access the required information as per your scenario.

Do have a look at these APIs.

https://help.sap.com/javadocs/NW04/current/um/index.html

Regards,

Ganesh N

Answers (2)

Answers (2)

0 Kudos

Hi ,

I am trying to use the IPortalComponentRequest class in my webdynpro code. but I am not able to find it in the classpath.

I have imported the following jars already..:

1) com.sap.portal.usermanagementapi.jar

2)com.sap.portal.pcd.glserviceapi.jar

Inspite of this, i am not able to execute the following code.

import com.sapportals.portal.prt.component.IPortalComponentRequest;

Please help.

Thanks in advance,

Kiran

Former Member
0 Kudos

HI,

you can see all the details in Activity reports which is present in

content administration -> activity report

if it is not available please check out the following path

content administration -> content provded by sap ->

admin content -> content administrators -> worksets -> activity report.

now add it to your content administrator role ie.,

content_admin_role if the workset is not present.

***********please reward points if the information is helpful to you************

Former Member
0 Kudos

actually i want to retrieve all this information programatically, and want to save the desired information in an Excel sheet

former_member189428
Contributor
0 Kudos

hi

shailesh

recently i done this here i past my code i hope its helps you

package com.sap;

import com.sapportals.htmlb.Form;

import com.sapportals.htmlb.FormLayout;

import com.sapportals.htmlb.FormLayoutRow;

import com.sapportals.htmlb.Link;

import com.sapportals.htmlb.Tree;

import com.sapportals.htmlb.TreeNode;

import com.sapportals.htmlb.page.DynPage;

import com.sapportals.htmlb.page.PageException;

import com.sapportals.portal.htmlb.page.PageProcessorComponent;

import com.sapportals.portal.prt.component.IPortalComponentContext;

import com.sapportals.portal.prt.component.IPortalComponentProfile;

import com.sapportals.portal.prt.component.IPortalComponentRequest;

import com.sapportals.portal.prt.component.IPortalComponentResponse;

import com.sapportals.portal.prt.component.IPortalComponentURI;

import com.sapportals.portal.security.usermanagement.IUser;

import com.sapportals.wcm.repository.ICollection;

import com.sapportals.wcm.repository.IResource;

import com.sapportals.wcm.repository.IResourceList;

import com.sapportals.wcm.repository.ResourceContext;

import com.sapportals.wcm.repository.ResourceFactory;

import com.sapportals.wcm.repository.enum.LinkType;

import com.sapportals.wcm.repository.manager.IPermission;

import com.sapportals.wcm.repository.manager.ISecurityManager;

import com.sapportals.wcm.util.uri.RID;

import com.sapportals.wcm.util.usermanagement.WPUMFactory;

public class DisplayKm extends PageProcessorComponent {

public DynPage getPage() {

return new UsingDynPagePage();

}

public class UsingDynPagePage extends DynPage {

private final static int READ_ONLY = 0;

private final static int EDIT = 1;

private int flag = READ_ONLY;

private com.sapportals.portal.prt.resource.IResource reslist;

private String navigationURI;

private String fileURL;

private String docsURI;

private Form myForm;

private String colWidth;

private FormLayout fl;

public void doInitialization() {

flag = READ_ONLY;

IPortalComponentRequest request =

(IPortalComponentRequest) this.getRequest();

IPortalComponentResponse response =

(IPortalComponentResponse) this.getResponse();

IPortalComponentContext myContext = request.getComponentContext();

IPortalComponentProfile profile = myContext.getProfile();

IPortalComponentURI componentURI =

request.createPortalComponentURI();

componentURI.setContextName("com.sap.km.cm.navigation");

navigationURI = componentURI.toString();

componentURI.setContextName("com.sap.km.cm.docs");

docsURI = componentURI.toString();

try {

fileURL = profile.getProperty("path");

colWidth = profile.getProperty("width");

IUser user = WPUMFactory.getUserFactory().getEP5User(request.getUser());

ResourceContext ctxt = new ResourceContext(user);

RID rid = RID.getRID(fileURL);

IResource resource =

ResourceFactory.getInstance().getResource(rid, ctxt);

// get Security Manager

ISecurityManager securityManager =

resource.getRepositoryManager().getSecurityManager(

resource);

IPermission iperm =

securityManager.getPermission("leaf_write_content");

if (securityManager.isAllowed(resource, user, iperm)) {

flag = EDIT;

} else {

flag = READ_ONLY;

}

ICollection collection = (ICollection) resource;

reslist = (com.sapportals.portal.prt.resource.IResource) collection.getChildren();

} catch (Exception e) {

response.write(e.getMessage());

}

}

public void doProcessAfterInput() throws PageException {

}

public void doProcessBeforeOutput() throws PageException {

myForm = getForm();

FormLayout fl = new FormLayout();

fl.setId("fl");

fl.setWidth("94%");

FormLayoutRow row1 = fl.addRow();

Tree tree = new Tree("S_Tree", "");

tree.setRootNodeIsVisible(false);

TreeNode root = new TreeNode("e_root", "Links");

root.setOpen(true);

add_node((IResourceList) reslist, root);

tree.setRootNode(root);

fl.addComponent(1, 1, tree);

if (flag == EDIT) {

String edit_url =

navigationURI

+ fileURL

+ "?StartUri="

+ fileURL

+ "&rndLayoutSet=LinkListMaintenance&layoutSetMode=exclusive";

Link link = new Link("Edit");

link.setTarget("_BLANK");

link.setReference(edit_url);

link.addText("Edit");

fl.addComponent(2, 1, link);

}

myForm.addComponent(fl);

}

public void add_node(IResourceList list, TreeNode name) {

String strtext;

String disname;

String strid;

IResourceList tmpreslist;

ICollection tmpcollection;

for (int i = 0; i < list.size(); i++) {

IResource tmpres = list.get(i);

try {

strid = tmpres.getName();

disname = tmpres.getDisplayName();

if (disname == null) {

disname = "";

}

if (disname.equals("") || disname == null) {

disname = strid;

}

strtext = disname;

if (tmpres.getLinkType() != LinkType.NONE) {

if (tmpres.getLinkType() == LinkType.EXTERNAL) {

strtext =

"<a class=urLnk href='"

+ tmpres.getTargetURL().toString()

+ "' target=_blank >";

strtext = strtext + disname + "</a>";

} else {

if (tmpres.isCollection()) {

strtext =

"<a class=urLnk href='"

+ navigationURI

+ tmpres.getTargetURL().toString()

+ "?StartUri="

+ tmpres.getTargetURL()

+ "' target=_blank >";

strtext = strtext + disname + "</a>";

} else {

strtext =

"<a class=urLnk href='"

+ docsURI

+ tmpres.getTargetURL().toString()

+ "' target=_blank >";

strtext = strtext + disname + "</a>";

}

}

} else if (!tmpres.isCollection()) {

strtext =

"<a class=urLnk href='"

+ docsURI

+ tmpres.getAccessURI()

+ "' target=_blank >";

strtext = strtext + disname + "</a>";

}

TreeNode name1 = new TreeNode(strid, strtext, name);

name1.setTooltip(strid);

if (tmpres.isCollection()

&& tmpres.getLinkType() == LinkType.NONE) {

tmpcollection = (ICollection) tmpres;

tmpreslist = tmpcollection.getChildren();

add_node(tmpreslist, name1);

}

} catch (Exception ex) {

IPortalComponentResponse response =

(IPortalComponentResponse) this.getResponse();

}

}

}

}

}

try it and let me know if u face any problems

Former Member
0 Kudos

hi ,

thanks for this code, but iam unable to run it as i guess i have some missing JAR files...could u help me with some of the additional <b>jar</b> files needed, for <b>IPermission, ICollection, Resource COntext</b> etc..

Thanks & Regards

Shailesh Nagar

former_member189428
Contributor
0 Kudos

hi

shailesh kumar,

jar files needed is

km.shared.repository.service.statemanagement_api.jar

com.sap.security.api.perm.jar

com.sap.security.api.ep5.jar

com.sap.security.api.jar

bc.util.public_api.jar

bc.util.kmmonitor_api.jar

bc.crt_api.jar

needed