mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-5236 Audit events for creating and deleting a user group.
This commit is contained in:
@@ -5,6 +5,8 @@ rm.audit.login-succeeded=Login Successful
|
|||||||
rm.audit.login-failed=Login Unsuccessful
|
rm.audit.login-failed=Login Unsuccessful
|
||||||
rm.audit.create-person=Create User
|
rm.audit.create-person=Create User
|
||||||
rm.audit.delete-person=Delete User
|
rm.audit.delete-person=Delete User
|
||||||
|
rm.audit.create-userGroup=Create User Group
|
||||||
|
rm.audit.delete-userGroup=Delete User Group
|
||||||
rm.audit.linkTo=Link to
|
rm.audit.linkTo=Link to
|
||||||
rm.audit.moveTo=Move to
|
rm.audit.moveTo=Move to
|
||||||
rm.audit.copyTo=Copy to
|
rm.audit.copyTo=Copy to
|
||||||
|
@@ -64,6 +64,18 @@
|
|||||||
<property name="label" value="rm.audit.delete-person" />
|
<property name="label" value="rm.audit.delete-person" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.create-userGroup" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.CreateUserGroupAuditEvent">
|
||||||
|
<property name="name" value="Create User Group"/>
|
||||||
|
<property name="label" value="rm.audit.create-userGroup"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="audit-event.delete-userGroup" parent="audit-event"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.audit.event.DeleteUserGroupAuditEvent">
|
||||||
|
<property name="nodeService" ref="nodeService" />
|
||||||
|
<property name="name" value="Delete User Group" />
|
||||||
|
<property name="label" value="rm.audit.delete-userGroup" />
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean id="audit-event.login-success" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent">
|
<bean id="audit-event.login-success" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.AuditEvent">
|
||||||
<property name="name" value="Login.Success"/>
|
<property name="name" value="Login.Success"/>
|
||||||
<property name="label" value="rm.audit.login-succeeded"/>
|
<property name="label" value="rm.audit.login-succeeded"/>
|
||||||
|
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy;
|
||||||
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
|
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audits user group creation.
|
||||||
|
*
|
||||||
|
* @author Tom Page
|
||||||
|
* @since 2.7
|
||||||
|
*/
|
||||||
|
@BehaviourBean
|
||||||
|
public class CreateUserGroupAuditEvent extends AuditEvent implements OnCreateNodePolicy
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
@Behaviour(kind = BehaviourKind.CLASS, type = "cm:authorityContainer")
|
||||||
|
public void onCreateNode(ChildAssociationRef childAssocRef)
|
||||||
|
{
|
||||||
|
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,82 @@
|
|||||||
|
/*
|
||||||
|
* #%L
|
||||||
|
* Alfresco Records Management Module
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2005 - 2018 Alfresco Software Limited
|
||||||
|
* %%
|
||||||
|
* This file is part of the Alfresco software.
|
||||||
|
* -
|
||||||
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
|
* provided under the following open source license terms:
|
||||||
|
* -
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
* -
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
* -
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.audit.event;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.model.ContentModel;
|
||||||
|
import org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy;
|
||||||
|
import org.alfresco.repo.policy.annotation.Behaviour;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourBean;
|
||||||
|
import org.alfresco.repo.policy.annotation.BehaviourKind;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeService;
|
||||||
|
import org.alfresco.service.namespace.QName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Audits user group deletion.
|
||||||
|
*
|
||||||
|
* @author Tom Page
|
||||||
|
* @since 2.7
|
||||||
|
*/
|
||||||
|
@BehaviourBean
|
||||||
|
public class DeleteUserGroupAuditEvent extends AuditEvent implements BeforeDeleteNodePolicy
|
||||||
|
{
|
||||||
|
/** Node Service */
|
||||||
|
private NodeService nodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the node service
|
||||||
|
*
|
||||||
|
* @param nodeService nodeService to set
|
||||||
|
*/
|
||||||
|
public void setNodeService(NodeService nodeService)
|
||||||
|
{
|
||||||
|
this.nodeService = nodeService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Behaviour that will audit user deletion
|
||||||
|
*
|
||||||
|
* @param nodeRef the node to be deleted
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Behaviour(kind = BehaviourKind.CLASS, type = "cm:authorityContainer")
|
||||||
|
public void beforeDeleteNode(NodeRef nodeRef)
|
||||||
|
{
|
||||||
|
// Retrieve the authority name property to be audited
|
||||||
|
Map<QName, Serializable> auditProperties = new HashMap<>();
|
||||||
|
auditProperties.put(ContentModel.PROP_AUTHORITY_NAME,
|
||||||
|
nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_NAME));
|
||||||
|
|
||||||
|
//audit the property values before the delete event
|
||||||
|
recordsManagementAuditService.auditEvent(nodeRef, getName(), auditProperties, null, true, false);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user