Search the FirstSpirit Knowledge Base
Hello FS Gurus,
We are using FS 5.2 with an SAP Portal 7.3.
We already use the permissions module to have control over who gets to see what content.
The way in which that works is quite simple; we use a permissions XML file in conjunction with the CMS_INPUT_PERMISSION set in the following way
<CMS_INPUT_PERMISSION name="metaperm" group="GroupsFile" hFill="yes">
<ACTIVITIES>
<ACTIVITY name="allowed"/>
</ACTIVITIES>
<LANGINFOS>
<LANGINFO lang="*" label="PERMISSIONS"/>
</LANGINFOS>
</CMS_INPUT_PERMISSION>
In the portal, within the jsp files published by FS we check if a user has the permission to see a page or even certain sections in a page.
There is an unfortunate misalignment in the terminology used: Objects which are named GROUPS in FirstSpirit (in the XML) are then created in the portal during publication. They are created as ROLES within the portal not as GROUPS. (In our case Groups are objects which are read directly from an Active Directory).
We would like to be able to use LiveEdit in the portal. Our wish is to have the highlighting activated only for users who are editors of a specific page with edit permissions for that page within FirstSpirit. Edit permissions are not managed using the above XML file. They are directly set by using the screens available through context menu->Extras->Change Permissions
To set these editing permissions for ContentCreator, we use Groups both internal (Everyone, Administrators) and external (from the same Active Directory as for the portal). No content editing permissions are set individually.
We would like to be able to recover the values of these edit permissions by Group and to publish them within every page.
When the user browses content in the Portal we can recover his/her membership in Groups or Roles. We should then be able to iterate through and compare the edit permission values from FS to the Roles and Groups in which the user is a member. We could then activate or deactivate highlighting page by page using the "window.ContentCreator.setEnabled(boolean)" call in javascript.
Can you point me in the right direction concerning the recovery of these edit permissions ? I assume it's possible using the FS API but for the moment I haven't found the right approach.
Thanks!
Peter
Hello Peter,
you should be able to retrieve all permission fields you need by using the interface de.espirit.firstspirit.access.store.Permission (Access API).
The rough idea could be as follows:
This is how the FS-API can be used:
$CMS_SET(set_groups,#global.project.getGroups())$
$CMS_FOR(group,set_groups)$
$CMS_VALUE(#global.page.getPermission(group).canChange())$
$CMS_END_FOR$
Maybe you want to generate a result like this:
String canChangeGroups="Chief-Editors,Editors";
Examples for using the Portal-API (not tested or complete!):
IUser user= UMFactory.getAuthenticator().getLoggedInUser(request, response);
Iterator itRoles= user.getRoles(true);
String currentRoleId;
IRoleFactory roleFactory= UMFactory.getRoleFactory();
IRole currentRole;
String displayName;
boolean isEditor = false;
while(itRoles.hasNext()) {
currentRoleId= (String) itRoles.next();
currentRole= roleFactory.getRole(currentRoleId);
displayName = currentRole.getDisplayName();
if(canChangeGroups.indexOf(displayName) != -1) {
isEditor = true;
}
}
Do these examples help you?
Hello Peter,
do you need further help or did Tanja's reply already help you? If so, it would be great if you marked
her reply as "correct answer" so that other community users find the solution easily. If you have
already found a solution by yourself, it would be very kind of you, if you posted it here.
Best regards,
Hannes