04-23-2010 02:57 PM
09-21-2010 12:07 PM
<actionSet id="document">
[..]
<action type="action-link" id="onActionArchive" permission="intranet,SiteManager" label="actions.document.archive" />
<action type="action-link" id="onEmailToSubscribed" permission="intranet,SiteManager,newsletter" label="actions.document.emailToSubscribed" />
</actionSet>
run: function Evaluator_run(node, isParent) {
..
switch (nodeType) {
..
case "document":
..
// Google Docs editable aspect?
if (node.hasAspect("{http://www.alfresco.org/model/googledocs/1.0}googleEditable"))
{
permissions["googledocs-edit"] = true;
}
// Intranet document ?
if (node.hasAspect("ehpo:intranetdocument"))
{
permissions["intranet"] = true;
}
// Newsletter ?
if (node.displayPath.search("Nieuws/Nieuwsbrief") > -1)
{
permissions["newsletter"] = true;
permissions["intranet"] = true;
}
break;
}
}
run: function Evaluator_run(node, isParent) {
..
// When evaluating parent container
if (isParent)
{
Evaluator.parentContainer(node, permissions);
}
{ // based on user role
var sitename = null;
try {
// get the current site (quick scripting - hope there's a better way)
sitename = node.displayPath.split("/Company Home/Sites/")[1].split("/")[0];
// (getting the first foldername after /Company/Sites/ from the nodes path)
} catch(e) {
; // Nullpointer or IndexOutOfBounds occured, so the path is not matching the expected sites pattern
}
var site = null;
if(sitename != null) {
site = Common.getSite(sitename); //retrieve the site not using siteService.getSite(sitename) but use the cached Common function
}
if(site != null) {
// get the current user
var username = person.properties.userName;
// check the role of the user in this site
var role = site.getMembersRole(username);
permissions[role] = true; //SiteManager
}
}
// Get relevant actions set
switch (nodeType) {
…
}
08-11-2011 05:35 AM
<actionSet id="document">
[..]
<action type="action-link" id="onActionAssignWorkflow" permission="start_workflow" label="actions.document.assign-workflow" />
</actionSet>
In permissionDefinitions.xml, I have added new permission :<permissionGroup name="Workflow" expose="true" allowFullControl="false" />
<permission name="_Workflow" expose="false" >
<grantedToGroup permissionGroup="Workflow" />
<!– Commented out parent permission check …
<requiredPermission on="parent" name="_ReadChildren" implies="false"/>
–>
</permission>
Then I've changed the Alfresco document library evaluator library to include the calculation of the start_workflow permissions in:permissions =
{
"start_workflow": node.hasPermission("Workflow"),
"create": node.hasPermission("CreateChildren"),
"edit": node.hasPermission("Write"),
"delete": node.hasPermission("Delete"),
"permissions": node.hasPermission("ChangePermissions"),
"cancel-checkout": node.hasPermission("CancelCheckOut")
};
and
// When evaluating parent container
if (isParent)
{
Evaluator.parentContainer(node, permissions);
}
{ // based on user role
var sitename = null;
try {
// get the current site (quick scripting - hope there's a better way)
sitename = node.displayPath.split("/Company Home/Sites/")[1].split("/")[0];
// (getting the first foldername after /Company/Sites/ from the nodes path)
} catch(e) {
; // Nullpointer or IndexOutOfBounds occured, so the path is not matching the expected sites pattern
}
var site = null;
if(sitename != null) {
site = Common.getSite(sitename); //retrieve the site not using siteService.getSite(sitename) but use the cached Common function
}
if(site != null) {
// get the current user
var username = person.properties.userName;
// check the role of the user in this site
var role = site.getMembersRole(username);
if(role != "SiteCustomManager"){
permissions[start_workflow] = true;
}
else
{
permissions[start_workflow] = false;
}
}
}
[..]
But it doesn't work./**
* Document and Folder common evaluators
*/
documentAndFolder: function Evaluator_documentAndFolder(node, permissions, status, actionLabels)
{
/* Simple Workflow */
if (node.hasAspect("app:simpleworkflow"))
{
permissions["start_workflow"] = true; // THIS LINE !!!
status["simple-workflow"] = true;
if (node.properties["app:approveStep"] != null)
{
permissions["simple-approve"] = true;
actionLabels["onActionSimpleApprove"] = node.properties["app:approveStep"];
}
if (node.properties["app:rejectStep"] != null)
{
permissions["simple-reject"] = true;
actionLabels["onActionSimpleReject"] = node.properties["app:rejectStep"];
}
}
}
but it fails too.05-11-2012 08:03 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.