简体   繁体   English

关闭超出交易范围的Alfresco政策

[英]Turn off Alfresco policy beyond transactional scope

I would like to create a service to toggle policies on and off by QName from an external system. 我想创建一个服务,通过QName从外部系统打开和关闭策略。 Primarily, I want to disable the auditable policies which prevents my external system from pushing in content and setting the modified/created dates. 首先,我想禁用可审计的策略,以防止我的外部系统推送内容并设置修改/创建的日期。 I am aware of the BehaviourFilter , but those changes are restricted to the current transaction. 我知道BehaviourFilter ,但这些更改仅限于当前事务。 I would prefer to have some control over turning the policy on and off without restarting the system. 我宁愿在没有重新启动系统的情况下控制打开和关闭策略。

How do I prevent a policy from firing for an unspecified amount of time, beyond a single transaction? 除了单个事务之外,如何防止策略在未指定的时间内触发?

Alfresco's auditable policies are so often subject for irritations and the needed work arounds are unnecessary waste of time. Alfresco的可审计政策经常受到激怒,所需的工作是不必要的浪费时间。 I'd like to discuss a solution which is more work but which may avoid the trouble in future with more flexibility since Alfresco combined two things which shouldn't be combined: 我想讨论一个更有效的解决方案,但由于Alfresco结合了两个不应该合并的东西,因此可以避免将来更加灵活的麻烦:

  • modified and created date 修改和创建日期
  • audit modified and created date 审核修改和创建日期

The first one is exposed to the file protocols and should be writable from the client. 第一个是暴露给文件协议,应该可以从客户端写入。 There are so many use cases where we need to set the dates (moving files from and to alfresco, native apps which brake if date is changed by server) 有很多用例我们需要设置日期(将文件移入和移动到露天,本机应用程序如果日期由服务器更改则会制动)

The second one is for the admins and compliance guys only and should be exposed as independant properties thru the service api and Web UI - not thru the file protocols. 第二个是仅针对管理员和合规人员,应该通过服务API和Web UI作为独立属性公开 - 而不是通过文件协议。

Since Alfresco combines both use cases in only one database column / one property we will always have trouble. 由于Alfresco只在一个数据库列/一个属性中结合了两个用例,我们总是会遇到麻烦。 Either the file protocol use cases doesn't work or we can't trust the audit attributes. 文件协议用例不起作用,或者我们不能信任审计属性。

My suggestion would be to separate this by introducing 2 new properties in the model: 我的建议是通过在模型中引入2个新属性来分离它:

  • createdDate, modifiedDate (there are only the audit times persisted at the moment) createdDate,modifiedDate(目前只保留审核时间)

and map these properties to the file protocol's dates. 并将这些属性映射到文件协议的日期。 A policy would manage the update on these properties if not set by the client (all except file protocols?) 如果客户端没有设置策略,那么策略将管理这些属性的更新(所有文件协议除外?)

My intention would be to put this in a community module / patch. 我的意图是将其放入社区模块/补丁中。

Any feedback to this approach? 对这种方法的任何反馈? Maybe someone to sponsor this? 也许有人赞助这个?

It's good that you're aware about the BehaviourFilter, but you're probably missing the point why you shouldn't be totally disable the policy for a time-period and then re-enabling it. 你很了解BehaviourFilter,但是你可能错过了为什么你不应该在一段时间内完全禁用策略然后重新启用它的原因。 If by chance the external system sends a signal to disable the policy and parallel a user is using Alfresco and uploading, that means that it isn't triggered any more. 如果外部系统偶然发送信号以禁用策略并且并行用户正在使用Alfresco并上传,则意味着它不再被触发。

Hence you really should use the BehaviourFilter within your writing transaction from the external system. 因此,您真的应该在外部系统的写入事务中使用BehaviourFilter

How: Create custom webscript which disables the BehaviourFilter for the QNAME/Node and re-enables it again. 方法:创建自定义webscript,禁用QNAME / Node的BehaviourFilter并再次重新启用它。 If you look at Alfresco's RecordsManagement code it uses the same principle. 如果你看看Alfresco的RecordsManagement代码,它使用相同的原则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM