Merge branch 'master' into feature/RM-6302_EditDispositionSchedule

This commit is contained in:
Ross Gale
2018-05-09 14:33:33 +01:00
39 changed files with 875 additions and 50 deletions

View File

@@ -35,8 +35,13 @@ package org.alfresco.rest.rm.community.model.audit;
*/
public enum AuditEvents
{
CREATE_PERSON("Create Person","Create User"),
DELETE_PERSON("Delete Person","Delete User");
CREATE_PERSON("Create Person", "Create User"),
DELETE_PERSON("Delete Person", "Delete User"),
CREATE_USER_GROUP("Create User Group", "Create User Group"),
DELETE_USER_GROUP("Delete User Group", "Delete User Group"),
ADD_TO_USER_GROUP("Add To User Group", "Add To User Group"),
REMOVE_FROM_USER_GROUP("Remove From User Group", "Remove From User Group"),
LOGIN_UNSUCCESSFUL("Login.Failure", "Login Unsuccessful");
/** event audited */
public final String event;

View File

@@ -0,0 +1,174 @@
/*
* #%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.rest.rm.community.audit;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.ADD_TO_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.CREATE_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.DELETE_USER_GROUP;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.REMOVE_FROM_USER_GROUP;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.testng.AssertJUnit.assertTrue;
import java.util.List;
import com.google.common.collect.ImmutableMap;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.audit.AuditEntry;
import org.alfresco.rest.v0.RMAuditAPI;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.model.GroupModel;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* This class contains the tests that check the group events are audited
*
* @author Claudia Agache
* @since 2.7
*/
@AlfrescoTest (jira = "RM-5236")
public class AuditGroupEventsTests extends BaseRMRestTest
{
@Autowired
private RMAuditAPI rmAuditAPI;
private GroupModel testGroup;
private UserModel testUser;
@BeforeClass (alwaysRun = true)
public void cleanAuditLogs()
{
//clean audit logs
rmAuditAPI.clearAuditLog(getAdminUser().getUsername(), getAdminUser().getPassword());
}
/**
* Given I have created a new group
* When I view the RM audit
* Then there is an entry showing that I created a group
*/
@Test
public void createGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
STEP("Get the list of audit entries for the create group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, CREATE_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the created group.");
assertTrue("The list of events is not filtered by " + CREATE_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(CREATE_USER_GROUP.eventDisplayName)));
assertTrue("The group name for the new group created is not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(CREATE_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())));
}
/**
* Given I have added a user to a group
* When I view the RM audit
* Then there is an entry showing that I have added a user to a group
*/
@Test
public void addUserToGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
testUser = getDataUser().createRandomTestUser();
dataGroup.usingUser(testUser).addUserToGroup(testGroup);
STEP("Get the list of audit entries for the add user to group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, ADD_TO_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the add user to group event.");
assertTrue("The list of events is not filtered by " + ADD_TO_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(ADD_TO_USER_GROUP.eventDisplayName)));
assertTrue("The username and destination group are not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(ADD_TO_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", testUser.getUsername(), "previous", "", "name", "User Name"))
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", testGroup.getGroupIdentifier(), "previous", "", "name", "Parent Group"))));
}
/**
* Given I have removed a user from a group
* When I view the RM audit
* Then there is an entry showing that I have removed a user from a group
*/
@Test
public void removeUserFromGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
testUser = getDataUser().createRandomTestUser();
dataGroup.usingUser(testUser).addUserToGroup(testGroup);
dataGroup.removeUserFromGroup(testGroup, testUser);
STEP("Get the list of audit entries for the add user to group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, REMOVE_FROM_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the remove user from group event.");
assertTrue("The list of events is not filtered by " + REMOVE_FROM_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(REMOVE_FROM_USER_GROUP.eventDisplayName)));
assertTrue("The username and previous parent group are not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(REMOVE_FROM_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "", "previous", testUser.getUsername(), "name", "User Name"))
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "","previous", testGroup.getGroupIdentifier(), "name", "Parent Group"))));
}
/**
* Given I have deleted a group
* When I view the RM audit
* Then there is an entry showing that I have deleted a group
*/
@Test
public void deleteGroupEventIsAudited()
{
testGroup = dataGroup.createRandomGroup();
dataGroup.deleteGroup(testGroup);
STEP("Get the list of audit entries for the delete group event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, DELETE_USER_GROUP.event);
STEP("Check the audit log contains only the entries for the created group.");
assertTrue("The list of events is not filtered by " + DELETE_USER_GROUP.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(DELETE_USER_GROUP.eventDisplayName)));
assertTrue("The group name for the deleted group is not audited.",
auditEntries.stream().filter(auditEntry -> auditEntry.getEvent().equals(DELETE_USER_GROUP.eventDisplayName))
.anyMatch(auditEntry -> auditEntry.getNodeName().equals(testGroup.getGroupIdentifier())
&& auditEntry.getChangedValues().contains(ImmutableMap.of("new", "", "previous", testGroup.getGroupIdentifier(), "name", "authorityDisplayName"))));
}
}

View File

@@ -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.rest.rm.community.audit;
import static org.alfresco.rest.rm.community.model.audit.AuditEvents.LOGIN_UNSUCCESSFUL;
import static org.alfresco.utility.report.log.Step.STEP;
import static org.testng.AssertJUnit.assertTrue;
import java.util.List;
import org.alfresco.rest.rm.community.base.BaseRMRestTest;
import org.alfresco.rest.rm.community.model.audit.AuditEntry;
import org.alfresco.rest.v0.RMAuditAPI;
import org.alfresco.test.AlfrescoTest;
import org.alfresco.utility.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* This class contains the tests that check the login events are audited
*
* @author Claudia Agache
* @since 2.7
*/
@AlfrescoTest (jira = "RM-5234")
public class AuditLoginEvents extends BaseRMRestTest
{
@Autowired
private RMAuditAPI rmAuditAPI;
@BeforeClass (alwaysRun = true)
public void cleanAuditLogs()
{
//clean audit logs
rmAuditAPI.clearAuditLog(getAdminUser().getUsername(), getAdminUser().getPassword());
}
/**
* Given I have tried to login using invalid credentials
* When I view the RM audit filtered by Login unsuccessful event
* Then the audit log contains only the entries for the Login unsuccessful event
*/
@Test
public void filterByLoginUnsuccessful() throws Exception
{
restClient.authenticateUser(new UserModel(getAdminUser().getUsername(), "InvalidPassword"));
restClient.withCoreAPI().getSites();
STEP("Get the list of audit entries for the login unsuccessful event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, LOGIN_UNSUCCESSFUL.event);
STEP("Check the audit log contains only the entries for the login unsuccessful event.");
assertTrue("The list of events is not filtered by " + LOGIN_UNSUCCESSFUL.event,
auditEntries.stream().allMatch(auditEntry -> auditEntry.getEvent().equals(LOGIN_UNSUCCESSFUL.eventDisplayName)));
}
}

View File

@@ -73,7 +73,7 @@ public class AuditUserEventsTests extends BaseRMRestTest
createUser = getDataUser().createUser(userName);
STEP("Get the list of audit entries for the create person event.");
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getPassword(),
List<AuditEntry> auditEntries = rmAuditAPI.getRMAuditLog(getAdminUser().getUsername(),
getAdminUser().getPassword(), 100, CREATE_PERSON.event);
STEP("Check the audit log contains only the entries for the created user.");
@@ -89,7 +89,7 @@ public class AuditUserEventsTests extends BaseRMRestTest
public void cleanAuditLogs()
{
//clean audit logs
rmAuditAPI.clearAuditLog(getAdminUser().getPassword(), getAdminUser().getPassword());
rmAuditAPI.clearAuditLog(getAdminUser().getUsername(), getAdminUser().getPassword());
}
@AfterClass (alwaysRun = true)

View File

@@ -3,8 +3,8 @@ dod_dod5015.description=Modelo de contenido de DOD5015
dod_dod5015.type.dod_site.title=Sitio de DOD5015
dod_dod5015.type.dod_site.description=Sitio de DOD5015
dod_dod5015.type.dod_filePlan.title=Plan de ficheros DOD5015
dod_dod5015.type.dod_filePlan.description=Plan de ficheros DOD5015
dod_dod5015.type.dod_filePlan.title=Cuadro de clasificaci\u00f3n DOD5015
dod_dod5015.type.dod_filePlan.description=Cuadro de clasificaci\u00f3n DOD5015
dod_dod5015.type.dod_recordSeries.title=Serie de documentos de archivo (depreciada)
dod_dod5015.type.dod_recordSeries.description=Serie de documentos de archivo (depreciada)

View File

@@ -37,7 +37,7 @@ rm.action.event-not-undone=No puede deshacer el evento {0} porque no se ha defin
rm.action.node-not-record-category=No puede crear una planificaci\u00f3n de retenci\u00f3n para ({0}) porque no es una categor\u00eda de documento de archivo.
rm.action.parameter-not-supplied=A\u00f1ada un ''{0}'' para continuar.
rm.action.delete-not-hold-type=No se pudo eliminar el bloqueo porque {1} no es del tipo {0}.
rm.action.cast-to-rm-type=No puede cargar un tipo de carpeta personalizada al plan de ficheros de Records Management.
rm.action.cast-to-rm-type=No puede cargar un tipo de carpeta personalizada al cuadro de clasificaci\u00f3n de Records Management.
rm.action.record-folder-create=No puede crear una carpeta de documentos de archivo en otra carpeta de documentos de archivo.
rm.action.unique.child.type-error-message=No puede crear elementos m\u00faltiples de este tipo aqu\u00ed.
rm.action.multiple.children.type-error-message=No puede crear {0} aqu\u00ed.

View File

@@ -35,7 +35,7 @@ hasDispositionAction.description=Los documentos de archivo y las carpetas tienen
# Are kind
isKind.title=Tipo de elemento de Records Management
isKind.description=Los elementos son una clase de componente del plan de ficheros
isKind.description=Los elementos son una clase de componente del cuadro de clasificaci\u00f3n
isKind.kind.display-label=Clase
# Are Record Type
@@ -49,12 +49,12 @@ isRecordType.description=Los documentos de archivo tienen un tipo de documento d
# Declare As Record
create-record.title=Declarar como documento de archivo
create-record.description=Declara el fichero como un documento de archivo
create-record.file-plan.display-label=Plan de ficheros
create-record.file-plan.display-label=Cuadro de clasificaci\u00f3n
create-record.hide-record.display-label=Ocultar documento de archivo
# Declare As Version Record
declare-as-version-record.title=Declarar la versi\u00f3n como documento de archivo
declare-as-version-record.description=Declara esta versi\u00f3n del fichero como un documento de archivo
declare-as-version-record.file-plan.display-label=Plan de ficheros
declare-as-version-record.file-plan.display-label=Cuadro de clasificaci\u00f3n
# Complete record
declareRecord.title=Documento de archivo completo
declareRecord.description=Completa un documento de archivo

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Login Successful
rm.audit.login-failed=Login Unsuccessful
rm.audit.create-person=Create User
rm.audit.delete-person=Delete User
rm.audit.create-userGroup=Create User Group
rm.audit.delete-userGroup=Delete User Group
rm.audit.addMember=Add To User Group
rm.audit.removeMember=Remove From User Group
rm.audit.linkTo=Link to
rm.audit.moveTo=Move to
rm.audit.copyTo=Copy to

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Anmeldung erfolgreich
rm.audit.login-failed=Anmeldung fehlgeschlagen
rm.audit.create-person=Benutzer anlegen
rm.audit.delete-person=Benutzer l\u00f6schen
rm.audit.create-userGroup=Benutzergruppe erstellen
rm.audit.delete-userGroup=Benutzergruppe l\u00f6schen
rm.audit.addMember=Zu Benutzergruppe hinzuf\u00fcgen
rm.audit.removeMember=Von Benutzergruppe entfernen
rm.audit.linkTo=Link zu
rm.audit.moveTo=Verschieben nach
rm.audit.copyTo=Kopieren nach

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Inicio de sesi\u00f3n correcto
rm.audit.login-failed=Error de inicio de sesi\u00f3n
rm.audit.create-person=Crear usuario
rm.audit.delete-person=Eliminar usuario
rm.audit.create-userGroup=Crear grupo de usuarios
rm.audit.delete-userGroup=Eliminar grupo de usuarios
rm.audit.addMember=A\u00f1adir a grupo de usuarios
rm.audit.removeMember=Eliminar de grupo de usuarios
rm.audit.linkTo=Enlace a
rm.audit.moveTo=Mover a
rm.audit.copyTo=Copiar a

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=La connexion a abouti
rm.audit.login-failed=La connexion a \u00e9chou\u00e9
rm.audit.create-person=Cr\u00e9er un utilisateur
rm.audit.delete-person=Supprimer un utilisateur
rm.audit.create-userGroup=Cr\u00e9er un groupe d'utilisateur
rm.audit.delete-userGroup=Supprimer le groupe d'utilisateur
rm.audit.addMember=Ajouter au groupe d'utilisateur
rm.audit.removeMember=Supprimer du groupe d'utilisateur
rm.audit.linkTo=Lier \u00e0
rm.audit.moveTo=D\u00e9placer vers...
rm.audit.copyTo=Copier vers...

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Login riuscito
rm.audit.login-failed=Login non riuscito
rm.audit.create-person=Crea utente
rm.audit.delete-person=Elimina utente
rm.audit.create-userGroup=Crea gruppo utenti
rm.audit.delete-userGroup=Elimina gruppo utenti
rm.audit.addMember=Aggiungi al gruppo utenti
rm.audit.removeMember=Rimuovi dal gruppo utenti
rm.audit.linkTo=Collega a
rm.audit.moveTo=Sposta in
rm.audit.copyTo=Copia in

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=\u30ed\u30b0\u30a4\u30f3\u6210\u529f
rm.audit.login-failed=\u30ed\u30b0\u30a4\u30f3\u5931\u6557
rm.audit.create-person=\u30e6\u30fc\u30b6\u30fc\u306e\u4f5c\u6210
rm.audit.delete-person=\u30e6\u30fc\u30b6\u30fc\u306e\u524a\u9664
rm.audit.create-userGroup=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210
rm.audit.delete-userGroup=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306e\u524a\u9664
rm.audit.addMember=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u306b\u8ffd\u52a0
rm.audit.removeMember=\u30e6\u30fc\u30b6\u30fc\u30b0\u30eb\u30fc\u30d7\u304b\u3089\u524a\u9664
rm.audit.linkTo=\u30ea\u30f3\u30af\u5148
rm.audit.moveTo=\u79fb\u52d5\u5148
rm.audit.copyTo=\u30b3\u30d4\u30fc\u5148

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Vellykket p\u00e5logging
rm.audit.login-failed=Mislykket p\u00e5logging
rm.audit.create-person=Opprett bruker
rm.audit.delete-person=Slett bruker
rm.audit.create-userGroup=Opprett brukergruppe
rm.audit.delete-userGroup=Slett brukergruppe
rm.audit.addMember=Legg til i brukergruppe
rm.audit.removeMember=Fjern fra brukergruppe
rm.audit.linkTo=Koble til
rm.audit.moveTo=Flytt til
rm.audit.copyTo=Kopier til

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Aanmelden geslaagd
rm.audit.login-failed=Aanmelden niet geslaagd
rm.audit.create-person=Gebruiker maken
rm.audit.delete-person=Gebruiker verwijderen
rm.audit.create-userGroup=Gebruikersgroep maken
rm.audit.delete-userGroup=Gebruikersgroep verwijderen
rm.audit.addMember=Toevoegen aan gebruikersgroep
rm.audit.removeMember=Verwijderen uit gebruikersgroep
rm.audit.linkTo=Koppelen naar
rm.audit.moveTo=Verplaatsen naar
rm.audit.copyTo=Kopi\u00ebren naar

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=Login bem-sucedido
rm.audit.login-failed=Login malsucedido
rm.audit.create-person=Criar usu\u00e1rio
rm.audit.delete-person=Excluir usu\u00e1rio
rm.audit.create-userGroup=Criar grupo de usu\u00e1rios
rm.audit.delete-userGroup=Excluir grupo de usu\u00e1rios
rm.audit.addMember=Adicionar ao grupo de usu\u00e1rios
rm.audit.removeMember=Remover do grupo de usu\u00e1rios
rm.audit.linkTo=Vincular a
rm.audit.moveTo=Mover para
rm.audit.copyTo=Copiar para

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=\u0412\u0445\u043e\u0434 \u0443\u0441\u043f\u0435\u0448
rm.audit.login-failed=\u041e\u0448\u0438\u0431\u043a\u0430 \u0432\u0445\u043e\u0434\u0430
rm.audit.create-person=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f
rm.audit.delete-person=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f
rm.audit.create-userGroup=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439
rm.audit.delete-userGroup=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439
rm.audit.addMember=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0433\u0440\u0443\u043f\u043f\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439
rm.audit.removeMember=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0438\u0437 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439
rm.audit.linkTo=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0441
rm.audit.moveTo=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432
rm.audit.copyTo=\u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432

View File

@@ -5,6 +5,10 @@ rm.audit.login-succeeded=\u767b\u5f55\u6210\u529f
rm.audit.login-failed=\u767b\u5f55\u5931\u8d25
rm.audit.create-person=\u521b\u5efa\u7528\u6237
rm.audit.delete-person=\u5220\u9664\u7528\u6237
rm.audit.create-userGroup=\u521b\u5efa\u7528\u6237\u7ec4
rm.audit.delete-userGroup=\u5220\u9664\u7528\u6237\u7ec4
rm.audit.addMember=\u52a0\u5230\u7528\u6237\u7ec4
rm.audit.removeMember=\u4ece\u7528\u6237\u7ec4\u79fb\u9664
rm.audit.linkTo=\u94fe\u63a5\u5230
rm.audit.moveTo=\u79fb\u52a8\u5230
rm.audit.copyTo=\u590d\u5236\u5230

View File

@@ -90,8 +90,8 @@ capability.ManageAccessRights.title=Administrar permisos
# Configuration
capability.group.config.title=Configuraci\u00f3n
capability.CreateModifyDestroyFileplanMetadata.title=Crear Modificar Destruir metadatos de plan de ficheros
capability.CreateModifyDestroyFileplanTypes.title=Crear Modificar Destruir tipos de plan de ficheros
capability.CreateModifyDestroyFileplanMetadata.title=Crear Modificar Destruir metadatos del cuadro de clasificaci\u00f3n
capability.CreateModifyDestroyFileplanTypes.title=Crear Modificar Destruir tipos del cuadro de clasificaci\u00f3n
capability.CreateModifyDestroyRecordTypes.title=Crear Modificar Destruir tipos de documento de archivo
capability.CreateAndAssociateSelectionLists.title=Crear y asociar listas de selecci\u00f3n
capability.EditSelectionLists.title=Editar listas de selecci\u00f3n

View File

@@ -4,10 +4,10 @@ rm.service.set-id=No puede cambiar el ID de {0} porque es de solo lectura.
rm.service.path-node=No se pudo encontrar {0}. Trate de actualizar el navegador o p\u00f3ngase en contacto con el dep. de TI.
rm.service.invalid-rm-node=El nodo de Records Management no es v\u00e1lido porque el aspecto {0} no est\u00e1 presente.
rm.service.no-root=No se pudo encontrar la ra\u00edz de Records Management. Trate de archivar el documento de archivo de nuevo.
rm.service.dup-root=No puede crear un plan de ficheros aqu\u00ed porque ya hay uno creado en esta jerarqu\u00eda de carpetas.
rm.service.root-type=No se puede crear el plan de ficheros porque el tipo {0} no es un subtipo de rma:filePlan. Vuelva a intentarlo usando un tipo diferente.
rm.service.container-parent-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordCategory).
rm.service.container-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del plan de ficheros o en otra categor\u00eda de documentos de archivo (rma:recordsManagementContainer o subtipo).
rm.service.dup-root=No puede crear un cuadro de clasificaci\u00f3n aqu\u00ed porque ya hay uno creado en esta jerarqu\u00eda de carpetas.
rm.service.root-type=No se puede crear el cuadro de clasificaci\u00f3n porque el tipo {0} no es un subtipo de rma:filePlan. Vuelva a intentarlo usando un tipo diferente.
rm.service.container-parent-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del cuadro de clasificaci\u00f3n o en otra categor\u00eda de documentos de archivo (rma:recordCategory).
rm.service.container-type=Solo puede crear una categor\u00eda de documentos de archivo en el nivel superior del cuadro de clasificaci\u00f3n o en otra categor\u00eda de documentos de archivo (rma:recordsManagementContainer o subtipo).
rm.service.container-expected=Solo puede encontrar contenidos de categor\u00eda de documentos de archivo en una categor\u00eda de documentos de archivo (rma:recordCategory o subtipo).
rm.service.record-folder-expected=La acci\u00f3n solo puede completarse usando una carpeta de documentos de archivo del tipo rma:recordFolder.
rm.service.parent-record-folder-root=No puede crear una carpeta de documentos de archivo aqu\u00ed. Trate de crearla en una categor\u00eda de documentos de archivo.

View File

@@ -122,8 +122,8 @@ rma_recordsmanagement.property.rma_transferLocation.decription=Transferencia de
rma_recordsmanagement.association.rma_transferred.title=Transferido
rma_recordsmanagement.association.rma_transferred.decription=Transferido
rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente del plan de ficheros
rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente del plan de ficheros
rma_recordsmanagement.aspect.rma_filePlanComponent.title=Componente del cuadro de clasificaci\u00f3n
rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Componente del cuadro de clasificaci\u00f3n
rma_recordsmanagement.property.rma_rootNodeRef.title=Nodo ra\u00edz
rma_recordsmanagement.property.rma_rootNodeRef.decription=Nodo ra\u00edz

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Alle einger\u00e4umten Berechtigun
rmevent.WGI_action_complete=WGI-Aktion abschlie\u00dfen
rmevent.separation=Trennung
rmevent.case_complete=Fall abgeschlossen
rmevent.declassification_review=Deklassifizierungs\u00fcberpr\u00fcfung

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Todas las provisiones otorgadas ha
rmevent.WGI_action_complete=Acci\u00f3n WGI completa
rmevent.separation=Separaci\u00f3n
rmevent.case_complete=Caso completo
rmevent.declassification_review=Revisi\u00f3n de la desclasificaci\u00f3n

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Toutes les autorisations accord\u0
rmevent.WGI_action_complete=Action WGI termin\u00e9e
rmevent.separation=S\u00e9paration
rmevent.case_complete=Cas termin\u00e9
rmevent.declassification_review=V\u00e9rification de d\u00e9classification

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Tutte le concessioni sono state te
rmevent.WGI_action_complete=Azione WGI completata
rmevent.separation=Separazione
rmevent.case_complete=Caso completato
rmevent.declassification_review=Esame di declassificazione

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=\u8a31\u53ef\u3055\u308c\u3066\u30
rmevent.WGI_action_complete=WGI \u51e6\u7406\u5b8c\u4e86
rmevent.separation=\u5206\u96e2
rmevent.case_complete=\u30b1\u30fc\u30b9\u5b8c\u4e86
rmevent.declassification_review=\u5206\u985e\u89e3\u9664\u306e\u30ec\u30d3\u30e5\u30fc

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Alle tillatelser som er gitt, er a
rmevent.WGI_action_complete=WGI-handling fullf\u00f8rt
rmevent.separation=Separasjon
rmevent.case_complete=Sak fullf\u00f8rt
rmevent.declassification_review=Gjennomgang av deklassifisering

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Alle toegekende rechten zijn be\u0
rmevent.WGI_action_complete=WGI-actie afgerond
rmevent.separation=Scheiding
rmevent.case_complete=Geval afgerond
rmevent.declassification_review=Classificatieopheffingsrevisie

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=Todas as bonifica\u00e7\u00f5es co
rmevent.WGI_action_complete=A\u00e7\u00e3o de WGI conclu\u00edda
rmevent.separation=Separa\u00e7\u00e3o
rmevent.case_complete=Caso conclu\u00eddo
rmevent.declassification_review=Revis\u00e3o de desclassifica\u00e7\u00e3o

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=\u0412\u0441\u0435 \u043f\u0440\u0
rmevent.WGI_action_complete=\u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0435 WGI \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e
rmevent.separation=\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435
rmevent.case_complete=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d
rmevent.declassification_review=\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0440\u0430\u0441\u0441\u0435\u043a\u0440\u0435\u0447\u0438\u0432\u0430\u043d\u0438\u044f

View File

@@ -20,3 +20,4 @@ rmevent.all_allowances_granted_are_terminated=\u6240\u6709\u6388\u4e88\u7684\u96
rmevent.WGI_action_complete=WGI \u64cd\u4f5c\u5b8c\u6210
rmevent.separation=\u5206\u79bb
rmevent.case_complete=\u6848\u4f8b\u5b8c\u6210
rmevent.declassification_review=\u53d6\u6d88\u5206\u7c7b\u7684\u5ba1\u67e5

View File

@@ -53,6 +53,7 @@
</bean>
<bean id="audit-event.create-person" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.CreatePersonAuditEvent">
<property name="nodeService" ref="nodeService" />
<property name="name" value="Create Person"/>
<property name="label" value="rm.audit.create-person"/>
</bean>
@@ -64,6 +65,31 @@
<property name="label" value="rm.audit.delete-person" />
</bean>
<bean id="audit-event.create-userGroup" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.CreateUserGroupAuditEvent">
<property name="nodeService" ref="nodeService" />
<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.addMember" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.AddToUserGroupAuditEvent">
<property name="nodeService" ref="nodeService" />
<property name="name" value="Add To User Group"/>
<property name="label" value="rm.audit.addMember"/>
</bean>
<bean id="audit-event.removeMember" parent="audit-event" class="org.alfresco.module.org_alfresco_module_rm.audit.event.RemoveFromUserGroupAuditEvent">
<property name="nodeService" ref="nodeService" />
<property name="name" value="Remove From User Group"/>
<property name="label" value="rm.audit.removeMember"/>
</bean>
<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="label" value="rm.audit.login-succeeded"/>

View File

@@ -27,8 +27,13 @@
package org.alfresco.module.org_alfresco_module_rm.audit;
import static org.alfresco.model.ContentModel.PROP_AUTHORITY_DISPLAY_NAME;
import static org.alfresco.model.ContentModel.PROP_AUTHORITY_NAME;
import static org.alfresco.model.ContentModel.PROP_USERNAME;
import static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.PARENT_GROUP;
import static org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model.TYPE_DOD_5015_SITE;
import static org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType.DEFAULT_SITE_NAME;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.BufferedWriter;
import java.io.File;
@@ -1102,7 +1107,18 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
}
else if (params.getEvent() != null)
{
auditQueryParams.addSearchKey(RM_AUDIT_DATA_EVENT_NAME, params.getEvent());
if (params.getEvent().equalsIgnoreCase(RM_AUDIT_EVENT_LOGIN_SUCCESS))
{
auditQueryParams.addSearchKey(RM_AUDIT_DATA_LOGIN_FULLNAME, null);
}
else if (params.getEvent().equalsIgnoreCase(RM_AUDIT_EVENT_LOGIN_FAILURE))
{
auditQueryParams.addSearchKey(RM_AUDIT_DATA_LOGIN_ERROR, null);
}
else
{
auditQueryParams.addSearchKey(RM_AUDIT_DATA_EVENT_NAME, params.getEvent());
}
}
// Get audit entries
@@ -1503,31 +1519,7 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
json.put("fullName", entry.getFullName() == null ? "": entry.getFullName());
json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef());
// TODO: Find another way for checking the event
if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null)
{
NodeRef nodeRef = entry.getNodeRef();
String userName = null;
if(nodeService.exists(nodeRef))
{
userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME);
}
json.put("nodeName", userName == null ? "": userName);
json.put("createPerson", true);
}
else if (entry.getEvent().equals("Delete Person") && entry.getNodeRef() != null)
{
if (entry.getBeforeProperties() != null)
{
String userName = (String) entry.getBeforeProperties().get(ContentModel.PROP_USERNAME);
json.put("nodeName", userName == null ? "" : userName);
}
json.put("deletePerson", true);
}
else
{
json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName());
}
setNodeName(entry, json);
// TODO: Find another way for checking the event
if (entry.getEvent().equals("Delete RM Object"))
@@ -1586,6 +1578,81 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean
}
}
/**
* Update a JSON object with a node name for an audit event.
*
* @param entry The audit event.
* @param json The object to update.
* @throws JSONException If there is a problem updating the JSON.
*/
private void setNodeName(RecordsManagementAuditEntry entry, JSONObject json) throws JSONException
{
String nodeName = null;
if (entry.getNodeRef() != null)
{
// TODO: Find another way for checking the event
switch (entry.getEvent())
{
case "Create Person":
nodeName = getNodeName(entry.getAfterProperties(), PROP_USERNAME);
// This is needed as older audit events (pre-2.7) were created without PROP_USERNAME being set.
NodeRef nodeRef = entry.getNodeRef();
if (nodeName == null && nodeService.exists(nodeRef))
{
nodeName = (String) nodeService.getProperty(nodeRef, PROP_USERNAME);
}
json.put("createPerson", true);
break;
case "Delete Person":
nodeName = getNodeName(entry.getBeforeProperties(), PROP_USERNAME);
json.put("deletePerson", true);
break;
case "Create User Group":
nodeName = getNodeName(entry.getAfterProperties(), PROP_AUTHORITY_DISPLAY_NAME, PROP_AUTHORITY_NAME);
break;
case "Delete User Group":
nodeName = getNodeName(entry.getBeforeProperties(), PROP_AUTHORITY_DISPLAY_NAME, PROP_AUTHORITY_NAME);
break;
case "Add To User Group":
nodeName = getNodeName(entry.getAfterProperties(), PARENT_GROUP);
break;
case "Remove From User Group":
nodeName = getNodeName(entry.getBeforeProperties(), PARENT_GROUP);
break;
default:
nodeName = entry.getNodeName();
break;
}
}
json.put("nodeName", nodeName == null ? "" : nodeName);
}
/**
* Get a node name using the first non-blank value from a properties object using a list of property names.
*
* @param properties The properties object.
* @param propertyNames The names of the properties to use. Return the first value that is not empty.
* @return The value of the property, or null if it's not there.
*/
private String getNodeName(Map<QName, Serializable> properties, QName... propertyNames)
{
for (QName propertyName : propertyNames)
{
String nodeName = (properties != null ? (String) properties.get(propertyName) : null);
if (!isBlank(nodeName))
{
return nodeName;
}
}
return null;
}
/**
* Helper method to convert value to MLText
*

View File

@@ -0,0 +1,74 @@
/*
* #%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 static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.makePropertiesMap;
import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy;
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;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Add an authority to a user group.
*
* @author Tom Page
* @since 2.7
*/
@BehaviourBean(defaultType = "cm:authorityContainer")
public class AddToUserGroupAuditEvent extends AuditEvent implements OnCreateChildAssociationPolicy
{
/** Node Service */
private NodeService nodeService;
/**
* Sets the node service
*
* @param nodeService nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** Behaviour to audit adding an authority to a user group. */
@Override
@Behaviour(kind = BehaviourKind.ASSOCIATION, notificationFrequency = EVERY_EVENT, assocType = "cm:member")
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
{
Map<QName, Serializable> auditProperties = makePropertiesMap(childAssocRef, nodeService);
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties, true);
}
}

View File

@@ -27,11 +27,18 @@
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.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;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Audits person creation.
@@ -42,17 +49,30 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
@BehaviourBean
public class CreatePersonAuditEvent extends AuditEvent implements OnCreateNodePolicy
{
/** Node Service */
private NodeService nodeService;
/**
* Sets the node service
*
* @param nodeService nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/**
* @see org.alfresco.repo.node.NodeServicePolicies.OnCreateNodePolicy#onCreateNode(org.alfresco.service.cmr.repository.ChildAssociationRef)
*/
@Override
@Behaviour
(
kind = BehaviourKind.CLASS,
type = "cm:person"
)
@Behaviour(kind = BehaviourKind.CLASS, type = "cm:person")
public void onCreateNode(ChildAssociationRef childAssocRef)
{
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName());
Map<QName, Serializable> auditProperties = new HashMap<>();
auditProperties.put(ContentModel.PROP_USERNAME,
nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_USERNAME));
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties);
}
}

View File

@@ -0,0 +1,75 @@
/*
* #%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.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;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Audits user group creation.
*
* @author Tom Page
* @since 2.7
*/
@BehaviourBean
public class CreateUserGroupAuditEvent extends AuditEvent implements OnCreateNodePolicy
{
/** Node Service */
private NodeService nodeService;
/**
* Sets the node service
*
* @param nodeService nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** Behaviour to audit user group creation. */
@Override
@Behaviour(kind = BehaviourKind.CLASS, type = "cm:authorityContainer")
public void onCreateNode(ChildAssociationRef childAssocRef)
{
Map<QName, Serializable> auditProperties = new HashMap<>();
auditProperties.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME,
nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_AUTHORITY_DISPLAY_NAME));
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), null, auditProperties);
}
}

View File

@@ -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 group 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_DISPLAY_NAME,
nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_DISPLAY_NAME));
//audit the property values before the delete event
recordsManagementAuditService.auditEvent(nodeRef, getName(), auditProperties, null, true, false);
}
}

View File

@@ -0,0 +1,74 @@
/*
* #%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 static org.alfresco.module.org_alfresco_module_rm.audit.event.UserGroupMembershipUtils.makePropertiesMap;
import static org.alfresco.repo.policy.Behaviour.NotificationFrequency.EVERY_EVENT;
import java.io.Serializable;
import java.util.Map;
import org.alfresco.repo.node.NodeServicePolicies.OnDeleteChildAssociationPolicy;
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;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Remove an authority from a user group.
*
* @author Tom Page
* @since 2.7
*/
@BehaviourBean(defaultType = "cm:authorityContainer")
public class RemoveFromUserGroupAuditEvent extends AuditEvent implements OnDeleteChildAssociationPolicy
{
/** Node Service */
private NodeService nodeService;
/**
* Sets the node service
*
* @param nodeService nodeService to set
*/
public void setNodeService(NodeService nodeService)
{
this.nodeService = nodeService;
}
/** Behaviour to audit removing an authority from a user group. */
@Override
@Behaviour(kind = BehaviourKind.ASSOCIATION, notificationFrequency = EVERY_EVENT, assocType = "cm:member")
public void onDeleteChildAssociation(ChildAssociationRef childAssocRef)
{
Map<QName, Serializable> auditProperties = makePropertiesMap(childAssocRef, nodeService);
recordsManagementAuditService.auditEvent(childAssocRef.getChildRef(), getName(), auditProperties, null, true);
}
}

View File

@@ -0,0 +1,92 @@
/*
* #%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 static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
/**
* Utility class for creating audit events about user group membership.
*
* @author Tom Page
* @since 2.7
*/
public class UserGroupMembershipUtils
{
/** A QName to display for the parent group's name. */
public static final QName PARENT_GROUP = QName.createQName(RecordsManagementModel.RM_URI, "Parent Group");
/** A QName to display for a child group's name. */
private static final QName CHILD_GROUP = QName.createQName(RecordsManagementModel.RM_URI, "Child Group");
/**
* Create a properties map from the given cm:member association.
*
* @param childAssocRef The association to use.
* @param nodeService The node service.
* @return A map containing the names of the parent and child.
*/
public static Map<QName, Serializable> makePropertiesMap(ChildAssociationRef childAssocRef, NodeService nodeService)
{
Map<QName, Serializable> auditProperties = new HashMap<>();
// Set exactly one of the child group property or the child user name property.
String childGroupName = getUserGroupName(childAssocRef.getChildRef(), nodeService);
if (!isBlank(childGroupName))
{
auditProperties.put(CHILD_GROUP, childGroupName);
}
String childUserName = (String) nodeService.getProperty(childAssocRef.getChildRef(), ContentModel.PROP_USERNAME);
if (!isBlank(childUserName))
{
auditProperties.put(ContentModel.PROP_USERNAME, childUserName);
}
// Set the parent group name.
auditProperties.put(PARENT_GROUP, getUserGroupName(childAssocRef.getParentRef(), nodeService));
return auditProperties;
}
/** Get a name that can be displayed for the user group. */
private static String getUserGroupName(NodeRef nodeRef, NodeService nodeService)
{
String groupName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_DISPLAY_NAME);
if (isBlank(groupName))
{
groupName = (String) nodeService.getProperty(nodeRef, ContentModel.PROP_AUTHORITY_NAME);
}
return groupName;
}
}