mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2502 Create new constraint for initial classification.
Previously we were restricting the initial classification to be a level that the current user could access, but this is not always the case for downgraded content. Also add new integration test for initial classification constraint. I tried adding a test that extended our BaseRMTestCase, but the transactions all happened as system (or admin maybe?), and so the level 2 user is always allowed to reclassify level 1 content (by the constraint). Consequently I ended up creating a stand-alone test for this. +review RM git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@110144 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -44,6 +44,15 @@ public interface ClassificationSchemeService
|
||||
*/
|
||||
List<ClassificationLevel> getClassificationLevels();
|
||||
|
||||
/**
|
||||
* Returns an immutable list of all the classification levels defined in the system.
|
||||
*
|
||||
* @return classification levels in descending order from highest to lowest
|
||||
* (where fewer users have access to the highest classification levels
|
||||
* and therefore access to the most restricted documents).
|
||||
*/
|
||||
List<ClassificationLevel> getAllClassificationLevels();
|
||||
|
||||
/**
|
||||
* Returns an immutable list of the defined classification reasons.
|
||||
* @return classification reasons in the order that they are defined.
|
||||
|
@@ -90,6 +90,16 @@ public class ClassificationSchemeServiceImpl extends ServiceBaseImpl implements
|
||||
return restrictList(levelManager.getClassificationLevels(), usersLevel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClassificationLevel> getAllClassificationLevels()
|
||||
{
|
||||
if (levelManager == null)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return levelManager.getClassificationLevels();
|
||||
}
|
||||
|
||||
@Override public List<ClassificationReason> getClassificationReasons()
|
||||
{
|
||||
return reasonManager == null ? Collections.<ClassificationReason>emptyList() :
|
||||
|
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2015 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.classification;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Check that a value is a valid initial {@link ClassificationLevel} by checking the {@link ClassificationSchemeService}.
|
||||
* The initial classification level is allowed to be any level, regardless of the clearance of the current user.
|
||||
*
|
||||
* @author tpage
|
||||
* @since 3.0.a
|
||||
*/
|
||||
public class InitialClassificationLevelConstraint extends ClassificationSchemeEntityConstraint
|
||||
{
|
||||
/**
|
||||
* Get the allowed values. Note that these are <tt>String</tt> instances, but may
|
||||
* represent non-<tt>String</tt> values. It is up to the caller to distinguish.
|
||||
*
|
||||
* @return the values allowed.
|
||||
*/
|
||||
@Override
|
||||
protected List<String> getAllowedValues()
|
||||
{
|
||||
List<ClassificationLevel> classificationLevels = classificationSchemeService.getAllClassificationLevels();
|
||||
List<String> values = new ArrayList<String>();
|
||||
for (ClassificationLevel classificationLevel : classificationLevels)
|
||||
{
|
||||
values.add(classificationLevel.getId());
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user