mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-622 ("Manage Permissions" for "File Plan" influence "Manage Permissions" for "Unfiled Records")
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@47840 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js">
|
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/filters.lib.js">
|
||||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js">
|
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-filters.lib.js">
|
||||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js">
|
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/parse-args.lib.js">
|
||||||
|
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/rm-parse-args.lib.js">
|
||||||
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.lib.js">
|
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary-v2/doclist.lib.js">
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -0,0 +1,142 @@
|
|||||||
|
/**
|
||||||
|
* Get and parse arguments
|
||||||
|
*
|
||||||
|
* @method getParsedArgs
|
||||||
|
* @return {array|null} Array containing the validated input parameters
|
||||||
|
*/
|
||||||
|
ParseArgs.getParsedArgs = function RecordsManagementFilter_getParsedArgs(containerType)
|
||||||
|
{
|
||||||
|
var type = url.templateArgs.type,
|
||||||
|
libraryRoot = args.libraryRoot,
|
||||||
|
rootNode = null,
|
||||||
|
pathNode = null,
|
||||||
|
nodeRef = null,
|
||||||
|
path = "",
|
||||||
|
location = null;
|
||||||
|
|
||||||
|
// Is this library rooted from a non-site nodeRef?
|
||||||
|
if (libraryRoot !== null)
|
||||||
|
{
|
||||||
|
libraryRoot = ParseArgs.resolveNode(libraryRoot);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (url.templateArgs.store_type !== null)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* nodeRef input: store_type, store_id and id
|
||||||
|
*/
|
||||||
|
var storeType = url.templateArgs.store_type,
|
||||||
|
storeId = url.templateArgs.store_id,
|
||||||
|
id = url.templateArgs.id;
|
||||||
|
|
||||||
|
nodeRef = storeType + "://" + storeId + "/" + id;
|
||||||
|
rootNode = libraryRoot || ParseArgs.resolveNode(nodeRef);
|
||||||
|
if (rootNode == null)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "Not a valid nodeRef: '" + nodeRef + "'");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special case: make sure filter picks up correct mode
|
||||||
|
if (type == null && args.filter == null)
|
||||||
|
{
|
||||||
|
args.filter = "node";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Site and container input
|
||||||
|
*/
|
||||||
|
var siteId = url.templateArgs.site,
|
||||||
|
containerId = url.templateArgs.container,
|
||||||
|
siteNode = siteService.getSite(siteId);
|
||||||
|
|
||||||
|
if (siteNode === null)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_GONE, "Site not found: '" + siteId + "'");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rootNode = siteNode.getContainer(containerId);
|
||||||
|
if (rootNode === null)
|
||||||
|
{
|
||||||
|
rootNode = siteNode.createContainer(containerId, containerType || "cm:folder");
|
||||||
|
if (rootNode === null)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_GONE, "Document Library container '" + containerId + "' not found in '" + siteId + "'. (No permission?)");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
rootNode.properties["cm:description"] = "Document Library";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MOB-593: Add email alias on documentLibrary container creation
|
||||||
|
*
|
||||||
|
rootNode.addAspect("emailserver:aliasable");
|
||||||
|
var emailAlias = siteId;
|
||||||
|
if (containerId != "documentLibrary")
|
||||||
|
{
|
||||||
|
emailAlias += "-" + containerId;
|
||||||
|
}
|
||||||
|
rootNode.properties["emailserver:alias"] = emailAlias;
|
||||||
|
*/
|
||||||
|
rootNode.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.filter == "unfiledRecords")
|
||||||
|
{
|
||||||
|
var unfiledRecordContainer = rootNode.childrenByXPath("rma:Unfiled_x0020_Records");
|
||||||
|
pathNode = unfiledRecordContainer.length > 0 ? unfiledRecordContainer[0] : rootNode;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Path input?
|
||||||
|
path = url.templateArgs.path || "";
|
||||||
|
pathNode = path.length > 0 ? rootNode.childByNamePath(path) : (pathNode || rootNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pathNode === null)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "Path not found: '" + path + "'");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parent location parameter adjustment
|
||||||
|
location = Common.getLocation(pathNode, libraryRoot);
|
||||||
|
if (location === null)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_GONE, "Location is 'null'. (No permission?)");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (path !== "")
|
||||||
|
{
|
||||||
|
location.path = ParseArgs.combinePaths(location.path, location.file);
|
||||||
|
}
|
||||||
|
if (args.filter !== "node" && !pathNode.isContainer)
|
||||||
|
{
|
||||||
|
location.file = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
var objRet =
|
||||||
|
{
|
||||||
|
rootNode: rootNode,
|
||||||
|
pathNode: pathNode,
|
||||||
|
libraryRoot: libraryRoot,
|
||||||
|
location: location,
|
||||||
|
path: path,
|
||||||
|
nodeRef: nodeRef,
|
||||||
|
type: type
|
||||||
|
};
|
||||||
|
|
||||||
|
// Multiple input files in the JSON body?
|
||||||
|
var files = ParseArgs.getMultipleInputValues("nodeRefs");
|
||||||
|
if (typeof files != "string")
|
||||||
|
{
|
||||||
|
objRet.files = files;
|
||||||
|
}
|
||||||
|
|
||||||
|
return objRet;
|
||||||
|
};
|
Reference in New Issue
Block a user