mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-1763: Record Contributors Group
* if configured, RECORD_CONTRIBUTOR group controls who can declare records within collaboration sites git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@91414 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -47,3 +47,9 @@ rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:c
|
|||||||
# Global RM disposition lifecycle trigger cron job expression
|
# Global RM disposition lifecycle trigger cron job expression
|
||||||
#
|
#
|
||||||
rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ?
|
rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ?
|
||||||
|
|
||||||
|
#
|
||||||
|
# Records contributors group
|
||||||
|
#
|
||||||
|
rm.record.contributors.group.enabled=false
|
||||||
|
rm.record.contributors.group.name=RECORD_CONTRIBUTORS
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
parent="module.baseComponent">
|
parent="module.baseComponent">
|
||||||
<property name="nodeService" ref="nodeService" />
|
<property name="nodeService" ref="nodeService" />
|
||||||
<property name="modulePatchExecuter" ref="rm.modulePatchExecuter" />
|
<property name="modulePatchExecuter" ref="rm.modulePatchExecuter" />
|
||||||
|
<property name="recordContributorsGroupBootstrapComponent" ref="recordContributorsGroupBootstrapComponent"/>
|
||||||
<property name="moduleId" value="org_alfresco_module_rm"/>
|
<property name="moduleId" value="org_alfresco_module_rm"/>
|
||||||
<property name="name" value="org_alfresco_module_rm_bootstrapData"/>
|
<property name="name" value="org_alfresco_module_rm_bootstrapData"/>
|
||||||
<property name="description" value="Bootstrap records management data"/>
|
<property name="description" value="Bootstrap records management data"/>
|
||||||
@@ -32,6 +33,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- Record contributors group bootstrap component -->
|
||||||
|
<bean id="recordContributorsGroupBootstrapComponent"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponent">
|
||||||
|
<property name="authorityService" ref="AuthorityService" />
|
||||||
|
<property name="authenticationUtil" ref="rm.authenticationUtil"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<!-- Bootstap the message property files -->
|
<!-- Bootstap the message property files -->
|
||||||
<bean id="org_alfresco_module_rm_resourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
|
<bean id="org_alfresco_module_rm_resourceBundles" class="org.alfresco.i18n.ResourceBundleBootstrapComponent">
|
||||||
<property name="resourceBundles">
|
<property name="resourceBundles">
|
||||||
@@ -50,6 +58,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<!-- Import RM model -->
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/rm-model-context.xml"/>
|
||||||
|
|
||||||
<!-- Import RM Audit -->
|
<!-- Import RM Audit -->
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
<property name="description" value="RM patch executer"/>
|
<property name="description" value="RM patch executer"/>
|
||||||
<property name="sinceVersion" value="2.2"/>
|
<property name="sinceVersion" value="2.2"/>
|
||||||
<property name="executeOnceOnly" value="false"/>
|
<property name="executeOnceOnly" value="false"/>
|
||||||
<property name="moduleSchema" value="1009"/>
|
<property name="moduleSchema" value="1010"/>
|
||||||
<property name="attributeService" ref="AttributeService" />
|
<property name="attributeService" ref="AttributeService" />
|
||||||
<property name="dependsOn">
|
<property name="dependsOn">
|
||||||
<list>
|
<list>
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v20-context.xml"/>
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v21-context.xml"/>
|
||||||
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml"/>
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v22-context.xml"/>
|
||||||
|
<import resource="classpath:alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml"/>
|
||||||
|
|
||||||
<!-- compatibility beans -->
|
<!-- compatibility beans -->
|
||||||
|
|
||||||
|
@@ -0,0 +1,17 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
|
||||||
|
|
||||||
|
<beans>
|
||||||
|
|
||||||
|
<!-- RM v2.3 Patches -->
|
||||||
|
|
||||||
|
<bean id="rm.recordContributorsGroupPatch"
|
||||||
|
parent="rm.parentModulePatch"
|
||||||
|
class="org.alfresco.module.org_alfresco_module_rm.patch.v23.RMv23RecordContributorsGroupPatch">
|
||||||
|
<property name="description" value="Create record contributors group."/>
|
||||||
|
<property name="fixesToSchema" value="1009"/>
|
||||||
|
<property name="targetSchema" value="1010"/>
|
||||||
|
<property name="recordContributorsGroupBootstrapComponent" ref="recordContributorsGroupBootstrapComponent"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
</beans>
|
@@ -6,8 +6,12 @@
|
|||||||
<bean id="jsonConversionComponentCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
<bean id="jsonConversionComponentCache" class="org.alfresco.repo.cache.DefaultSimpleCache" />
|
||||||
|
|
||||||
<!-- extending bean definition -->
|
<!-- extending bean definition -->
|
||||||
<bean id="rm.jsonConversionComponent" class="org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent"
|
<bean id="rm.jsonConversionComponent"
|
||||||
parent="baseJsonConversionComponent" init-method="init">
|
class="org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent"
|
||||||
|
parent="baseJsonConversionComponent"
|
||||||
|
init-method="init">
|
||||||
|
<property name="recordContributorsGroupEnabled" value="${rm.record.contributors.group.enabled}"/>
|
||||||
|
<property name="recordContributorsGroupName" value="${rm.record.contributors.group.name}"/>
|
||||||
<property name="recordService" ref="RecordService"/>
|
<property name="recordService" ref="RecordService"/>
|
||||||
<property name="filePlanService" ref="FilePlanService"/>
|
<property name="filePlanService" ref="FilePlanService"/>
|
||||||
<property name="capabilityService" ref="CapabilityService"/>
|
<property name="capabilityService" ref="CapabilityService"/>
|
||||||
|
@@ -41,6 +41,9 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
|
|||||||
/** module patch executer */
|
/** module patch executer */
|
||||||
private ModulePatchExecuter modulePatchExecuter;
|
private ModulePatchExecuter modulePatchExecuter;
|
||||||
|
|
||||||
|
/** record contributors group bootstrap component */
|
||||||
|
private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeService node service
|
* @param nodeService node service
|
||||||
*/
|
*/
|
||||||
@@ -57,6 +60,14 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
|
|||||||
this.modulePatchExecuter = modulePatchExecuter;
|
this.modulePatchExecuter = modulePatchExecuter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component
|
||||||
|
*/
|
||||||
|
public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent)
|
||||||
|
{
|
||||||
|
this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Need to check whether this module has already been executed.
|
* Need to check whether this module has already been executed.
|
||||||
*
|
*
|
||||||
@@ -70,6 +81,9 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent
|
|||||||
{
|
{
|
||||||
super.executeInternal();
|
super.executeInternal();
|
||||||
|
|
||||||
|
// bootstrap the record contributors group
|
||||||
|
recordContributorsGroupBootstrapComponent.createRecordContributorsGroup();
|
||||||
|
|
||||||
// init module schema number
|
// init module schema number
|
||||||
modulePatchExecuter.initSchemaVersion();
|
modulePatchExecuter.initSchemaVersion();
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record contributors group bootstrap component
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class RecordContributorsGroupBootstrapComponent
|
||||||
|
{
|
||||||
|
// default record contributors group
|
||||||
|
public static final String RECORD_CONTRIBUTORS = "RECORD_CONTRIBUTORS";
|
||||||
|
public static final String GROUP_RECORD_CONTRIBUTORS = "GROUP_" + RECORD_CONTRIBUTORS;
|
||||||
|
|
||||||
|
/** authority service */
|
||||||
|
private AuthorityService authorityService;
|
||||||
|
|
||||||
|
/** authentication utils */
|
||||||
|
private AuthenticationUtil authenticationUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authorityService authority service
|
||||||
|
*/
|
||||||
|
public void setAuthorityService(AuthorityService authorityService)
|
||||||
|
{
|
||||||
|
this.authorityService = authorityService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authenticationUtil authentication util
|
||||||
|
*/
|
||||||
|
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
|
||||||
|
{
|
||||||
|
this.authenticationUtil = authenticationUtil;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create record contributor group
|
||||||
|
*/
|
||||||
|
public void createRecordContributorsGroup()
|
||||||
|
{
|
||||||
|
if (!authorityService.authorityExists(GROUP_RECORD_CONTRIBUTORS))
|
||||||
|
{
|
||||||
|
// create record contributors group
|
||||||
|
authorityService.createAuthority(AuthorityType.GROUP, RECORD_CONTRIBUTORS);
|
||||||
|
|
||||||
|
// add the admin user
|
||||||
|
authorityService.addAuthority(GROUP_RECORD_CONTRIBUTORS, authenticationUtil.getAdminUserName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -63,123 +63,64 @@ public interface RMPermissionModel
|
|||||||
String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString();
|
String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString();
|
||||||
|
|
||||||
// Capability permissions
|
// Capability permissions
|
||||||
|
|
||||||
String DECLARE_RECORDS = "DeclareRecords";
|
String DECLARE_RECORDS = "DeclareRecords";
|
||||||
|
|
||||||
String VIEW_RECORDS = "ViewRecords";
|
String VIEW_RECORDS = "ViewRecords";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_FOLDERS = "CreateModifyDestroyFolders";
|
String CREATE_MODIFY_DESTROY_FOLDERS = "CreateModifyDestroyFolders";
|
||||||
|
|
||||||
String EDIT_RECORD_METADATA = "EditRecordMetadata";
|
String EDIT_RECORD_METADATA = "EditRecordMetadata";
|
||||||
|
|
||||||
String EDIT_NON_RECORD_METADATA = "EditNonRecordMetadata";
|
String EDIT_NON_RECORD_METADATA = "EditNonRecordMetadata";
|
||||||
|
|
||||||
String ADD_MODIFY_EVENT_DATES = "AddModifyEventDates";
|
String ADD_MODIFY_EVENT_DATES = "AddModifyEventDates";
|
||||||
|
|
||||||
String CLOSE_FOLDERS = "CloseFolders";
|
String CLOSE_FOLDERS = "CloseFolders";
|
||||||
|
|
||||||
String DECLARE_RECORDS_IN_CLOSED_FOLDERS = "DeclareRecordsInClosedFolders";
|
String DECLARE_RECORDS_IN_CLOSED_FOLDERS = "DeclareRecordsInClosedFolders";
|
||||||
|
|
||||||
String RE_OPEN_FOLDERS = "ReOpenFolders";
|
String RE_OPEN_FOLDERS = "ReOpenFolders";
|
||||||
|
|
||||||
String CYCLE_VITAL_RECORDS = "CycleVitalRecords";
|
String CYCLE_VITAL_RECORDS = "CycleVitalRecords";
|
||||||
|
|
||||||
String PLANNING_REVIEW_CYCLES = "PlanningReviewCycles";
|
String PLANNING_REVIEW_CYCLES = "PlanningReviewCycles";
|
||||||
|
|
||||||
String UPDATE_TRIGGER_DATES = "UpdateTriggerDates";
|
String UPDATE_TRIGGER_DATES = "UpdateTriggerDates";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_EVENTS = "CreateModifyDestroyEvents";
|
String CREATE_MODIFY_DESTROY_EVENTS = "CreateModifyDestroyEvents";
|
||||||
|
|
||||||
String MANAGE_ACCESS_RIGHTS = "ManageAccessRights";
|
String MANAGE_ACCESS_RIGHTS = "ManageAccessRights";
|
||||||
|
|
||||||
String MOVE_RECORDS = "MoveRecords";
|
String MOVE_RECORDS = "MoveRecords";
|
||||||
|
|
||||||
String CHANGE_OR_DELETE_REFERENCES = "ChangeOrDeleteReferences";
|
String CHANGE_OR_DELETE_REFERENCES = "ChangeOrDeleteReferences";
|
||||||
|
|
||||||
String DELETE_LINKS = "DeleteLinks";
|
String DELETE_LINKS = "DeleteLinks";
|
||||||
|
|
||||||
String EDIT_DECLARED_RECORD_METADATA = "EditDeclaredRecordMetadata";
|
String EDIT_DECLARED_RECORD_METADATA = "EditDeclaredRecordMetadata";
|
||||||
|
|
||||||
String MANUALLY_CHANGE_DISPOSITION_DATES = "ManuallyChangeDispositionDates";
|
String MANUALLY_CHANGE_DISPOSITION_DATES = "ManuallyChangeDispositionDates";
|
||||||
|
|
||||||
String APPROVE_RECORDS_SCHEDULED_FOR_CUTOFF = "ApproveRecordsScheduledForCutoff";
|
String APPROVE_RECORDS_SCHEDULED_FOR_CUTOFF = "ApproveRecordsScheduledForCutoff";
|
||||||
|
|
||||||
String CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS = "CreateModifyRecordsInCutoffFolders";
|
String CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS = "CreateModifyRecordsInCutoffFolders";
|
||||||
|
|
||||||
String EXTEND_RETENTION_PERIOD_OR_FREEZE = "ExtendRetentionPeriodOrFreeze";
|
String EXTEND_RETENTION_PERIOD_OR_FREEZE = "ExtendRetentionPeriodOrFreeze";
|
||||||
|
|
||||||
String UNFREEZE = "Unfreeze";
|
String UNFREEZE = "Unfreeze";
|
||||||
|
|
||||||
String VIEW_UPDATE_REASONS_FOR_FREEZE = "ViewUpdateReasonsForFreeze";
|
String VIEW_UPDATE_REASONS_FOR_FREEZE = "ViewUpdateReasonsForFreeze";
|
||||||
|
|
||||||
String DESTROY_RECORDS_SCHEDULED_FOR_DESTRUCTION = "DestroyRecordsScheduledForDestruction";
|
String DESTROY_RECORDS_SCHEDULED_FOR_DESTRUCTION = "DestroyRecordsScheduledForDestruction";
|
||||||
|
|
||||||
String DESTROY_RECORDS = "DestroyRecords";
|
String DESTROY_RECORDS = "DestroyRecords";
|
||||||
|
|
||||||
String UPDATE_VITAL_RECORD_CYCLE_INFORMATION = "UpdateVitalRecordCycleInformation";
|
String UPDATE_VITAL_RECORD_CYCLE_INFORMATION = "UpdateVitalRecordCycleInformation";
|
||||||
|
|
||||||
String UNDECLARE_RECORDS = "UndeclareRecords";
|
String UNDECLARE_RECORDS = "UndeclareRecords";
|
||||||
|
|
||||||
String DECLARE_AUDIT_AS_RECORD = "DeclareAuditAsRecord";
|
String DECLARE_AUDIT_AS_RECORD = "DeclareAuditAsRecord";
|
||||||
|
|
||||||
String DELETE_AUDIT = "DeleteAudit";
|
String DELETE_AUDIT = "DeleteAudit";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_TIMEFRAMES = "CreateModifyDestroyTimeframes";
|
String CREATE_MODIFY_DESTROY_TIMEFRAMES = "CreateModifyDestroyTimeframes";
|
||||||
|
|
||||||
String AUTHORIZE_NOMINATED_TRANSFERS = "AuthorizeNominatedTransfers";
|
String AUTHORIZE_NOMINATED_TRANSFERS = "AuthorizeNominatedTransfers";
|
||||||
|
|
||||||
String EDIT_SELECTION_LISTS = "EditSelectionLists";
|
String EDIT_SELECTION_LISTS = "EditSelectionLists";
|
||||||
|
|
||||||
String AUTHORIZE_ALL_TRANSFERS = "AuthorizeAllTransfers";
|
String AUTHORIZE_ALL_TRANSFERS = "AuthorizeAllTransfers";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_FILEPLAN_METADATA = "CreateModifyDestroyFileplanMetadata";
|
String CREATE_MODIFY_DESTROY_FILEPLAN_METADATA = "CreateModifyDestroyFileplanMetadata";
|
||||||
|
|
||||||
String CREATE_AND_ASSOCIATE_SELECTION_LISTS = "CreateAndAssociateSelectionLists";
|
String CREATE_AND_ASSOCIATE_SELECTION_LISTS = "CreateAndAssociateSelectionLists";
|
||||||
|
|
||||||
String ATTACH_RULES_TO_METADATA_PROPERTIES = "AttachRulesToMetadataProperties";
|
String ATTACH_RULES_TO_METADATA_PROPERTIES = "AttachRulesToMetadataProperties";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_FILEPLAN_TYPES = "CreateModifyDestroyFileplanTypes";
|
String CREATE_MODIFY_DESTROY_FILEPLAN_TYPES = "CreateModifyDestroyFileplanTypes";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_RECORD_TYPES = "CreateModifyDestroyRecordTypes";
|
String CREATE_MODIFY_DESTROY_RECORD_TYPES = "CreateModifyDestroyRecordTypes";
|
||||||
|
|
||||||
String MAKE_OPTIONAL_PARAMETERS_MANDATORY = "MakeOptionalParametersMandatory";
|
String MAKE_OPTIONAL_PARAMETERS_MANDATORY = "MakeOptionalParametersMandatory";
|
||||||
|
|
||||||
String MAP_EMAIL_METADATA = "MapEmailMetadata";
|
String MAP_EMAIL_METADATA = "MapEmailMetadata";
|
||||||
|
|
||||||
String DELETE_RECORDS = "DeleteRecords";
|
String DELETE_RECORDS = "DeleteRecords";
|
||||||
|
|
||||||
String TRIGGER_AN_EVENT = "TriggerAnEvent";
|
String TRIGGER_AN_EVENT = "TriggerAnEvent";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_ROLES = "CreateModifyDestroyRoles";
|
String CREATE_MODIFY_DESTROY_ROLES = "CreateModifyDestroyRoles";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_USERS_AND_GROUPS = "CreateModifyDestroyUsersAndGroups";
|
String CREATE_MODIFY_DESTROY_USERS_AND_GROUPS = "CreateModifyDestroyUsersAndGroups";
|
||||||
|
|
||||||
String PASSWORD_CONTROL = "PasswordControl";
|
String PASSWORD_CONTROL = "PasswordControl";
|
||||||
|
|
||||||
String ENABLE_DISABLE_AUDIT_BY_TYPES = "EnableDisableAuditByTypes";
|
String ENABLE_DISABLE_AUDIT_BY_TYPES = "EnableDisableAuditByTypes";
|
||||||
|
|
||||||
String SELECT_AUDIT_METADATA = "SelectAuditMetadata";
|
String SELECT_AUDIT_METADATA = "SelectAuditMetadata";
|
||||||
|
|
||||||
String DISPLAY_RIGHTS_REPORT = "DisplayRightsReport";
|
String DISPLAY_RIGHTS_REPORT = "DisplayRightsReport";
|
||||||
|
|
||||||
String ACCESS_AUDIT = "AccessAudit";
|
String ACCESS_AUDIT = "AccessAudit";
|
||||||
|
|
||||||
String EXPORT_AUDIT = "ExportAudit";
|
String EXPORT_AUDIT = "ExportAudit";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_REFERENCE_TYPES = "CreateModifyDestroyReferenceTypes";
|
String CREATE_MODIFY_DESTROY_REFERENCE_TYPES = "CreateModifyDestroyReferenceTypes";
|
||||||
|
|
||||||
String UPDATE_CLASSIFICATION_DATES = "UpdateClassificationDates";
|
String UPDATE_CLASSIFICATION_DATES = "UpdateClassificationDates";
|
||||||
|
|
||||||
String CREATE_MODIFY_DESTROY_CLASSIFICATION_GUIDES = "CreateModifyDestroyClassificationGuides";
|
String CREATE_MODIFY_DESTROY_CLASSIFICATION_GUIDES = "CreateModifyDestroyClassificationGuides";
|
||||||
|
|
||||||
String UPGRADE_DOWNGRADE_AND_DECLASSIFY_RECORDS = "UpgradeDowngradeAndDeclassifyRecords";
|
String UPGRADE_DOWNGRADE_AND_DECLASSIFY_RECORDS = "UpgradeDowngradeAndDeclassifyRecords";
|
||||||
|
|
||||||
String UPDATE_EXEMPTION_CATEGORIES = "UpdateExemptionCategories";
|
String UPDATE_EXEMPTION_CATEGORIES = "UpdateExemptionCategories";
|
||||||
|
|
||||||
String MAP_CLASSIFICATION_GUIDE_METADATA = "MapClassificationGuideMetadata";
|
String MAP_CLASSIFICATION_GUIDE_METADATA = "MapClassificationGuideMetadata";
|
||||||
|
|
||||||
String MANAGE_ACCESS_CONTROLS = "ManageAccessControls";
|
String MANAGE_ACCESS_CONTROLS = "ManageAccessControls";
|
||||||
|
|
||||||
String CREATE_HOLD = "CreateHold";
|
String CREATE_HOLD = "CreateHold";
|
||||||
String ADD_TO_HOLD = "AddToHold";
|
String ADD_TO_HOLD = "AddToHold";
|
||||||
String REMOVE_FROM_HOLD = "RemoveFromHold";
|
String REMOVE_FROM_HOLD = "RemoveFromHold";
|
||||||
|
@@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
import net.sf.acegisecurity.vote.AccessDecisionVoter;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent;
|
import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
@@ -276,7 +277,7 @@ public class RMSecurityCommon implements ApplicationContextAware
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AccessStatus result = permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS);
|
AccessStatus result = permissionService.hasPermission(filePlan, ViewRecordsCapability.NAME);
|
||||||
transactionCache.put(key, result);
|
transactionCache.put(key, result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
|
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ public class AssocPolicy extends AbstractBasePolicy
|
|||||||
ConfigAttributeDefinition cad)
|
ConfigAttributeDefinition cad)
|
||||||
{
|
{
|
||||||
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||||
return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
|
return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
|
package org.alfresco.module.org_alfresco_module_rm.capability.policy;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
import org.aopalliance.intercept.MethodInvocation;
|
import org.aopalliance.intercept.MethodInvocation;
|
||||||
|
|
||||||
@@ -38,6 +38,6 @@ public class ReadPolicy extends AbstractBasePolicy
|
|||||||
ConfigAttributeDefinition cad)
|
ConfigAttributeDefinition cad)
|
||||||
{
|
{
|
||||||
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent());
|
||||||
return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef);
|
return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -19,11 +19,13 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.jscript.app;
|
package org.alfresco.module.org_alfresco_module_rm.jscript.app;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel;
|
import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||||
@@ -53,9 +55,23 @@ import org.json.simple.JSONObject;
|
|||||||
*
|
*
|
||||||
* @author Roy Wetherall
|
* @author Roy Wetherall
|
||||||
*/
|
*/
|
||||||
public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent implements NodeServicePolicies.OnDeleteNodePolicy,
|
public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent
|
||||||
|
implements NodeServicePolicies.OnDeleteNodePolicy,
|
||||||
NodeServicePolicies.OnCreateNodePolicy
|
NodeServicePolicies.OnCreateNodePolicy
|
||||||
{
|
{
|
||||||
|
/** JSON values */
|
||||||
|
private static final String IS_RM_NODE = "isRmNode";
|
||||||
|
private static final String RM_NODE = "rmNode";
|
||||||
|
private static final String IS_RM_SITE_CREATED = "isRmSiteCreated";
|
||||||
|
private static final String IS_RECORD_CONTRIBUTOR_GROUP_ENABLED = "isRecordContributorGroupEnabled";
|
||||||
|
private static final String RECORD_CONTRIBUTOR_GROUP_NAME = "recordContributorGroupName";
|
||||||
|
|
||||||
|
/** true if record contributor group is enabled, false otherwise */
|
||||||
|
private boolean isRecordContributorsGroupEnabled = false;
|
||||||
|
|
||||||
|
/** record contributors group */
|
||||||
|
private String recordContributorsGroupName = "RECORD_CONTRIBUTORS";
|
||||||
|
|
||||||
/** Record service */
|
/** Record service */
|
||||||
private RecordService recordService;
|
private RecordService recordService;
|
||||||
|
|
||||||
@@ -86,6 +102,22 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
/** Constant for checking the cache */
|
/** Constant for checking the cache */
|
||||||
private static final String RM_SITE_EXISTS = "rmSiteExists";
|
private static final String RM_SITE_EXISTS = "rmSiteExists";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param enabled true if enabled, false otherwise
|
||||||
|
*/
|
||||||
|
public void setRecordContributorsGroupEnabled(boolean enabled)
|
||||||
|
{
|
||||||
|
isRecordContributorsGroupEnabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordContributorsGroupName record contributors group name
|
||||||
|
*/
|
||||||
|
public void setRecordContributorsGroupName(String recordContributorsGroupName)
|
||||||
|
{
|
||||||
|
this.recordContributorsGroupName = recordContributorsGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param recordService record service
|
* @param recordService record service
|
||||||
*/
|
*/
|
||||||
@@ -199,21 +231,25 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
// Set the base root values
|
// Set the base root values
|
||||||
super.setRootValues(nodeInfo, rootJSONObject, useShortQNames);
|
super.setRootValues(nodeInfo, rootJSONObject, useShortQNames);
|
||||||
|
|
||||||
|
// check the exisitance of the RM site
|
||||||
checkRmSiteExistence(rootJSONObject);
|
checkRmSiteExistence(rootJSONObject);
|
||||||
|
|
||||||
|
// get the record contributor information
|
||||||
|
rootJSONObject.put(IS_RECORD_CONTRIBUTOR_GROUP_ENABLED, isRecordContributorsGroupEnabled);
|
||||||
|
rootJSONObject.put(RECORD_CONTRIBUTOR_GROUP_NAME, recordContributorsGroupName);
|
||||||
|
|
||||||
// Get the node reference for convenience
|
// Get the node reference for convenience
|
||||||
NodeRef nodeRef = nodeInfo.getNodeRef();
|
NodeRef nodeRef = nodeInfo.getNodeRef();
|
||||||
|
|
||||||
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef,
|
if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, ViewRecordsCapability.NAME)))
|
||||||
RMPermissionModel.VIEW_RECORDS)))
|
|
||||||
{
|
{
|
||||||
// Indicate whether the node is a RM object or not
|
// Indicate whether the node is a RM object or not
|
||||||
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
|
boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef());
|
||||||
rootJSONObject.put("isRmNode", isFilePlanComponent);
|
rootJSONObject.put(IS_RM_NODE, isFilePlanComponent);
|
||||||
|
|
||||||
if (isFilePlanComponent)
|
if (isFilePlanComponent)
|
||||||
{
|
{
|
||||||
rootJSONObject.put("rmNode", setRmNodeValues(nodeRef, useShortQNames));
|
rootJSONObject.put(RM_NODE, setRmNodeValues(nodeRef, useShortQNames));
|
||||||
|
|
||||||
// FIXME: Is this the right place to add the information?
|
// FIXME: Is this the right place to add the information?
|
||||||
addInfo(nodeInfo, rootJSONObject);
|
addInfo(nodeInfo, rootJSONObject);
|
||||||
@@ -222,6 +258,11 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks for the existance of the RM site
|
||||||
|
*
|
||||||
|
* @param rootJSONObject the root JSON object
|
||||||
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private void checkRmSiteExistence(JSONObject rootJSONObject)
|
private void checkRmSiteExistence(JSONObject rootJSONObject)
|
||||||
{
|
{
|
||||||
@@ -231,17 +272,17 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
if (site != null)
|
if (site != null)
|
||||||
{
|
{
|
||||||
getJsonConversionComponentCache().put(RM_SITE_EXISTS, true);
|
getJsonConversionComponentCache().put(RM_SITE_EXISTS, true);
|
||||||
rootJSONObject.put("isRmSiteCreated", true);
|
rootJSONObject.put(IS_RM_SITE_CREATED, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getJsonConversionComponentCache().put(RM_SITE_EXISTS, false);
|
getJsonConversionComponentCache().put(RM_SITE_EXISTS, false);
|
||||||
rootJSONObject.put("isRmSiteCreated", false);
|
rootJSONObject.put(IS_RM_SITE_CREATED, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rootJSONObject.put("isRmSiteCreated", getJsonConversionComponentCache().get(RM_SITE_EXISTS));
|
rootJSONObject.put(IS_RM_SITE_CREATED, getJsonConversionComponentCache().get(RM_SITE_EXISTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,6 +334,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
|
|
||||||
if (originatingLocation != null)
|
if (originatingLocation != null)
|
||||||
{
|
{
|
||||||
|
// add the originating location (if there is one)
|
||||||
String pathSeparator = "/";
|
String pathSeparator = "/";
|
||||||
String displayPath = getDisplayPath(originatingLocation);
|
String displayPath = getDisplayPath(originatingLocation);
|
||||||
String[] displayPathElements = displayPath.split(pathSeparator);
|
String[] displayPathElements = displayPath.split(pathSeparator);
|
||||||
@@ -324,12 +366,14 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param nodeRef
|
* Helper method to set the RM node values
|
||||||
* @param useShortQName
|
*
|
||||||
* @return
|
* @param nodeRef node reference
|
||||||
|
* @param useShortQName indicates whether the short QName are used or not
|
||||||
|
* @return {@link JSONObject} JSON object containing values
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private JSONObject setRmNodeValues(NodeRef nodeRef, boolean useShortQName)
|
private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName)
|
||||||
{
|
{
|
||||||
JSONObject rmNodeValues = new JSONObject();
|
JSONObject rmNodeValues = new JSONObject();
|
||||||
|
|
||||||
@@ -340,20 +384,32 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONC
|
|||||||
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
|
FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef);
|
||||||
rmNodeValues.put("kind", kind.toString());
|
rmNodeValues.put("kind", kind.toString());
|
||||||
|
|
||||||
|
Map<String, Object> values = AuthenticationUtil.runAsSystem(new RunAsWork<Map<String, Object>>()
|
||||||
|
{
|
||||||
|
public Map<String, Object> doWork() throws Exception
|
||||||
|
{
|
||||||
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
|
|
||||||
// File plan node reference
|
// File plan node reference
|
||||||
NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
|
NodeRef filePlan = filePlanService.getFilePlan(nodeRef);
|
||||||
rmNodeValues.put("filePlan", filePlan.toString());
|
result.put("filePlan", filePlan.toString());
|
||||||
|
|
||||||
// Unfiled container node reference
|
// Unfiled container node reference
|
||||||
NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan);
|
NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan);
|
||||||
if (unfiledRecordContainer != null)
|
if (unfiledRecordContainer != null)
|
||||||
{
|
{
|
||||||
rmNodeValues.put("unfiledRecordContainer", unfiledRecordContainer.toString());
|
result.put("unfiledRecordContainer", unfiledRecordContainer.toString());
|
||||||
rmNodeValues.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName));
|
result.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName));
|
||||||
QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType();
|
QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType();
|
||||||
rmNodeValues.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString());
|
result.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
rmNodeValues.putAll(values);
|
||||||
|
|
||||||
// Set the indicators array
|
// Set the indicators array
|
||||||
setIndicators(rmNodeValues, nodeRef);
|
setIndicators(rmNodeValues, nodeRef);
|
||||||
|
|
||||||
|
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.patch.v23;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponent;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RM v2.3 patch that creates the record contributors group.
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class RMv23RecordContributorsGroupPatch extends AbstractModulePatch
|
||||||
|
{
|
||||||
|
/** record contributors group bootstrap component */
|
||||||
|
private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component
|
||||||
|
*/
|
||||||
|
public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent)
|
||||||
|
{
|
||||||
|
this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void applyInternal()
|
||||||
|
{
|
||||||
|
// create record contributors group
|
||||||
|
recordContributorsGroupBootstrapComponent.createRecordContributorsGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -29,8 +29,9 @@ import org.alfresco.service.cmr.repository.NodeRef;
|
|||||||
public interface FilePlanPermissionService
|
public interface FilePlanPermissionService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
* Setup permissions for a record category
|
||||||
*
|
*
|
||||||
* @param nodeRef
|
* @param nodeRef record category node reference
|
||||||
*/
|
*/
|
||||||
void setupRecordCategoryPermissions(NodeRef recordCategory);
|
void setupRecordCategoryPermissions(NodeRef recordCategory);
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ public class AuthenticationUtil
|
|||||||
/**
|
/**
|
||||||
* Helper method that gets the admin user name.
|
* Helper method that gets the admin user name.
|
||||||
* <p>
|
* <p>
|
||||||
* Usefule when testing using mocks.
|
* Useful when testing using mocks.
|
||||||
*
|
*
|
||||||
* @see org.alfresco.repo.security.authentication.AuthenticationUtil#getAdminUserName()
|
* @see org.alfresco.repo.security.authentication.AuthenticationUtil#getAdminUserName()
|
||||||
*/
|
*/
|
||||||
@@ -78,4 +78,13 @@ public class AuthenticationUtil
|
|||||||
return org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName();
|
return org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method that gets the system user name.
|
||||||
|
*
|
||||||
|
* @see org.alfresco.repo.security.authentication.AuthenticationUtil#getSystemUserName()
|
||||||
|
*/
|
||||||
|
public String getSystemUserName()
|
||||||
|
{
|
||||||
|
return org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.repo.importer.ImporterBootstrap;
|
||||||
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
|
import org.alfresco.service.cmr.repository.StoreRef;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bootstrap importer module component unit test
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class BootstrapImporterModuleComponentUnitTest extends BaseUnitTest
|
||||||
|
{
|
||||||
|
/** RM config node */
|
||||||
|
private static final NodeRef configNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder");
|
||||||
|
|
||||||
|
/** mocks */
|
||||||
|
@Mock(name="importer") private ImporterBootstrap mockedImporter;
|
||||||
|
@Mock(name="modulePatchExecuter") private ModulePatchExecuter mockedModulePatchExecuter;
|
||||||
|
@Mock(name="recordContributorsGroupBootstrapComponent") private RecordContributorsGroupBootstrapComponent mockedRecordContributorsGroupBootstrapComponent;
|
||||||
|
|
||||||
|
/** importer */
|
||||||
|
@InjectMocks
|
||||||
|
private BootstrapImporterModuleComponent importer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that the system has already been bootstraped
|
||||||
|
* When I try and boostrap the system
|
||||||
|
* Then the system is not bootstraped again
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void alreadyBootstraped() throws Throwable
|
||||||
|
{
|
||||||
|
// config node exists
|
||||||
|
doReturn(true).when(mockedNodeService).exists(configNodeRef);
|
||||||
|
|
||||||
|
// boostrap
|
||||||
|
importer.executeInternal();
|
||||||
|
|
||||||
|
// not bootstraped
|
||||||
|
verify(mockedImporter, never()).bootstrap();
|
||||||
|
verify(mockedModulePatchExecuter, never()).initSchemaVersion();
|
||||||
|
verify(mockedRecordContributorsGroupBootstrapComponent, never()).createRecordContributorsGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that the system has not been bootstraped
|
||||||
|
* When I try and bootstrap the system
|
||||||
|
* Then the system is bootstraped
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void boostrap() throws Throwable
|
||||||
|
{
|
||||||
|
// config node does not exist
|
||||||
|
doReturn(false).when(mockedNodeService).exists(configNodeRef);
|
||||||
|
|
||||||
|
// boostrap
|
||||||
|
importer.executeInternal();
|
||||||
|
|
||||||
|
// not bootstraped
|
||||||
|
verify(mockedImporter, times(1)).bootstrap();
|
||||||
|
verify(mockedModulePatchExecuter, times(1)).initSchemaVersion();
|
||||||
|
verify(mockedRecordContributorsGroupBootstrapComponent, times(1)).createRecordContributorsGroup();
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.module.org_alfresco_module_rm.bootstrap;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.doReturn;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
|
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mockito.InjectMocks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record contributors group bootstrap component unit test
|
||||||
|
*
|
||||||
|
* @author Roy Wetherall
|
||||||
|
* @since 2.3
|
||||||
|
*/
|
||||||
|
public class RecordContributorsGroupBootstrapComponentUnitTest extends BaseUnitTest
|
||||||
|
{
|
||||||
|
@InjectMocks
|
||||||
|
private RecordContributorsGroupBootstrapComponent component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that the record contributors group already exists
|
||||||
|
* When I try and create the group
|
||||||
|
* Then nothing happens
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void groupAlreadyExists()
|
||||||
|
{
|
||||||
|
// group already exists
|
||||||
|
doReturn(true).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS);
|
||||||
|
|
||||||
|
// create group
|
||||||
|
component.createRecordContributorsGroup();
|
||||||
|
|
||||||
|
// group not created
|
||||||
|
verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS);
|
||||||
|
verifyNoMoreInteractions(mockedAuthorityService);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given that the record contributors group does not exist
|
||||||
|
* When I try and create the group
|
||||||
|
* Then the group is successfully created
|
||||||
|
* And 'everyone' is added to the new group
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void createGroup()
|
||||||
|
{
|
||||||
|
// group does not exists
|
||||||
|
doReturn(false).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS);
|
||||||
|
|
||||||
|
// create group
|
||||||
|
component.createRecordContributorsGroup();
|
||||||
|
|
||||||
|
// group not created
|
||||||
|
verify(mockedAuthorityService, times(1)).createAuthority(AuthorityType.GROUP, RecordContributorsGroupBootstrapComponent.RECORD_CONTRIBUTORS);
|
||||||
|
verify(mockedAuthorityService, times(1)).addAuthority(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS, "admin");
|
||||||
|
verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS);
|
||||||
|
verifyNoMoreInteractions(mockedAuthorityService);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -19,6 +19,8 @@
|
|||||||
package org.alfresco.module.org_alfresco_module_rm.test;
|
package org.alfresco.module.org_alfresco_module_rm.test;
|
||||||
|
|
||||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportActionUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportActionUnitTest;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponentUnitTest;
|
||||||
|
import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponentUnitTest;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HoldCapabilityConditionUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HoldCapabilityConditionUnitTest;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementTypeFormFilterUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementTypeFormFilterUnitTest;
|
||||||
import org.alfresco.module.org_alfresco_module_rm.hold.HoldServiceImplUnitTest;
|
import org.alfresco.module.org_alfresco_module_rm.hold.HoldServiceImplUnitTest;
|
||||||
@@ -81,7 +83,11 @@ import org.junit.runners.Suite.SuiteClasses;
|
|||||||
|
|
||||||
// recorded version config
|
// recorded version config
|
||||||
RecordedVersionConfigGetTest.class,
|
RecordedVersionConfigGetTest.class,
|
||||||
RecordedVersionConfigPostTest.class
|
RecordedVersionConfigPostTest.class,
|
||||||
|
|
||||||
|
// bootstrap
|
||||||
|
BootstrapImporterModuleComponentUnitTest.class,
|
||||||
|
RecordContributorsGroupBootstrapComponentUnitTest.class
|
||||||
})
|
})
|
||||||
public class AllUnitTestSuite
|
public class AllUnitTestSuite
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user