Alfresco SetInherite 权限 webscript 安全 api

Alfresco SetInherite permission webscript security api

我尝试为 alfresco 创建脚本以设置继承权限,但我不知道我的脚本是否正确这是我的脚本:

Inherit.post.xml

<webscript>
<shortname>Inherit Permission</shortname>
<description>Inherit Permission of a User or  Group from a Folder or Space</description>
<url>/set/folder/permission/inherit/?folderName={folderName}</url>
<format default="html"/>
<transaction>required</transaction>
<authentication>user</authentication>

Inherit.post.html

<html>
<body>
<p>${myStatus}</p>
</body>
</html>

InheritePermission.post.js

//search for the folder node using lucene search
var folderNode =  search.luceneSearch("TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\" AND @cm\:name:"+args.folderName);

//make sure we only get one node

if(folderNode.length == 1){

folderNode[0].setInheritsPermissions(false);

model.myStatus = "Héritage permis";
}else  if (folderNode.length == 0){
//no node was found
model.myStatus = "Folder not found";
}else{
//either greater than two  was found
model.myStatus = "Duplicate folder found";
}

网页脚本的文件名应该如下所示。

  • helloworld.get.desc.xml(你的名字写错了应该是Inherit.post.desc.xml
  • helloworld.get.js
  • helloworld.get.html.ftl
  • helloworld.get.xml.ftl
  • helloworld.get.html.400.ftl
  • helloworld.get.xml.400.ftl
  • helloworld.get.config.xml
  • helloworld.get.properties

alfresco 中 webscript 的命名约定如下

<webscriptname>.<HTTPMethod>.desc.xml (For description file)
<webscriptname>.<HTTPMethod>.js (For javascript controller file of webscript)
<webscriptname>.<HTTPMethod>.<outputformat>.ftl (For response/template file)
<webscriptname>.<HTTPMethod>.properties (Property file)

HTTPMethod: values could be get,post,put,delete based on type of webscript required but it has to be consistent for all files(obviously :) ).

OutputFormat: output format represent type of output you are expecting values could be json,xml,html based on your requirement.