如何使用CMIS删除文档

编程入门 行业动态 更新时间:2024-10-20 13:39:58
本文介绍了如何使用CMIS删除文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用连接到露天存储库的Servlets创建了一个外部Web应用程序。

I have Created a External web application using Servlets which is connected to alfresco repository.

我也可以将文档上传到存储库,从存储库下载文档。

I am also able to upload document in to the repository, download document from repository.

现在我的要求是,我必须根据用户角色删除文档。意味着我想只允许删除文档访问网站管理员。

now my requirement is, i have to delete document based on user role. means i want to give delete document access to only site manager.

如果你有,请提供示例代码。

Please provide sample code if you have.

提前致谢

推荐答案

为了删除文档,您首先需要查看用户是否具有要删除的角色,这是为什么答案将分为两部分

In order to delete a document you first need to see if the user have the role to delete this is why the answer will be split in two part

第1部分:搜索权限

Part 1 : search for authority

在这部分中,您将看到用户是否有权删除

in this part you will see if the user have the authority to delete

Session session = getSession(serverUrl, username, password); // Get the session object = session.getObjectByPath(idObject); // get the object if (object.getAllowableActions().getAllowableActions().contains(Action.CAN_DELETE_OBJECT)) { //// You can delete } else { //// You can't delete System.out.println("I can't "); }

第2部分:删除方法

Part 2 : delete method

对于文档来说,删除它很简单

for a document it is simple to delete it

Session session = getSession(serverUrl, username, password); CmisObject object = session.getObject(path); Document suppDoc = (Document) object; suppDoc.delete(true);

请注意,文件夹不同,但只会更改第2部分(因为删除时)您需要删除其孩子的文件夹)

Note that it's different for a folder , but only the part 2 will be changed ( because when you delete a folder you need to delete his child's)

要完成此答案,您只需将第1部分与第2部分合并。

to complete this answer you only need to combine part 1 with part 2.

更多推荐

如何使用CMIS删除文档

本文发布于:2023-11-28 10:06:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641961.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   文档   CMIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!