khadi
khadi

Reputation: 187

Alfresco SetInherite permission webscript security api

I try to create script for alfresco for set Inherit permission, but i don't know if my script is correct this is my script :

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";
}

Upvotes: 0

Views: 601

Answers (2)

mitpatoliya
mitpatoliya

Reputation: 2037

Naming convention followed by webscript in alfresco are as follow

<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 :) ).

and

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

Upvotes: 0

Krutik Jayswal
Krutik Jayswal

Reputation: 3175

File name of web script should be like below.

  • helloworld.get.desc.xml (your name is wrong it should be 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

Upvotes: 1

Related Questions