我知道我可以在IT技术中授予权限。
${host}:4502/useradmin
当我双击用户登录并进入“权限”选项卡时,
我希望在部署内容包时授予权限。
这是否可能?
我知道我可以在IT技术中授予权限。
${host}:4502/useradmin
我想在部署内容包时给予权限。
您可以参考ACS Tools的ACL打包程序来打包ACL。
注意:安装包的用户需要有设置ACL的权限。
为了以编程方式设置ACL(正如您的问题标题所说), 您可能需要查看一些Jackrabbit/JCR接口/类。
org.apache.jackrabbit.api.security.JackrabbitAccessControlManager
org.apache.jackrabbit.api.security.JackrabbitAccessControlList
javax.jcr.security.Privilege
我在想要配置权限的文件夹下添加了一个名为的文件
_rep_policy.xml
带有这样内容的:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:primaryType="rep:ACL">
<allow
jcr:primaryType="rep:GrantACE"
rep:principalName="myusername"
rep:privileges="{Name}[jcr:read,rep:write,jcr:versionManagement,jcr:lockManagement]"/>
</jcr:root>
在pom.xml文件中,我添加了以下条目:
<profiles>
<profile>
<id>autoInstallContentPackage</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.day.jcr.vault</groupId>
<artifactId>content-package-maven-plugin</artifactId>
<executions>
<execution>
<id>install-package</id>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
<configuration>
...
<properties>
<acHandling>Overwrite</acHandling> //allow modify permissions
</properties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
....
curl -u admin:admin -X POST --noproxy localhost -FauthorizableId=MyGroup -Fchangelog=path:/content/site/page/path,read:true,modify:true,create:true,delete:true,acl_read:false,acl_edit:false,replicate:false http://localhost:4502/.cqactions.html