mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Fix so that Project Space policy code is moved to emailserver:aliasable onAddAspect - fixes 2 bugs and allows creation of project from any Project template
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7876 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
logger.log("onAddAspect policy code for emailserver:aliasable");
|
||||
var emailfolder = behaviour.args[0];
|
||||
// search for an app:projectfolder parent node
|
||||
var parent = emailfolder.parent;
|
||||
while (parent != null && parent.hasPermission("Read"))
|
||||
{
|
||||
if (parent.type == "{http://www.alfresco.org/model/application/1.0}projectfolder")
|
||||
{
|
||||
logger.log("Found parent app:project folder: " + parent.name);
|
||||
|
||||
var alias = normalise(parent.name);
|
||||
parent.properties["emailserver:alias"] = alias;
|
||||
parent.save();
|
||||
logger.log("Applied email alias of: " + alias);
|
||||
|
||||
break;
|
||||
}
|
||||
parent = parent.parent;
|
||||
}
|
||||
|
||||
function normalise(s)
|
||||
{
|
||||
// email alias has strict constraint
|
||||
return new String(s).toLowerCase().replace(/[^a-z^0-9^.]/g, "-");
|
||||
}
|
Reference in New Issue
Block a user