Class ClassificationManager
- java.lang.Object
-
- com.jalios.jcms.security.classified.ClassificationManager
-
- All Implemented Interfaces:
JPropertiesListener
public class ClassificationManager extends java.lang.Object implements JPropertiesListener
Manager class for all classification related controls.- Since:
- 10.0.8 / JCMS-10746
-
-
Field Summary
Fields Modifier and Type Field Description static int
BASELINE_LEVEL_DEFAULT
Default configuration of the baseline level.static java.lang.String
CLASSIFICATION_ADMIN_ACL
Name of the ACL authorizing classification level administrationstatic int
MAXIMUM_LEVEL_DEFAULT
Default configuration of maximum level.static boolean
MEMBER_CLEARANCE_ENABLED_DEFAULT
Default value for member authorization features.static java.lang.String
PROP_BASELINE_LEVEL
Name of property from which the reference level is read.static java.lang.String
PROP_ENABLED
Name of property to check if classification is enabled.static java.lang.String
PROP_MAXIMUM_LEVEL
Name of property from which maximum level is read.static java.lang.String
PROP_MEMBER_CLEARANCE_ENABLED
Name of boolean property used to read whether member clearance is enabled.static java.lang.String
PROP_PREFIX_CONSTRAINT_START_LEVEL
Name of property prefix from which the start level used of each constraint is read.static java.lang.String
PROP_PREFIX_FEATURE_MAXIMUM_LEVEL
Name of property prefix from which maximum level of each feature is read.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canAccessClassificationAdmin(Member mbr)
Check if the specified member is authorized to access classification admin console.int
getBaselineLevel()
Retrieve the reference classification level to used for unspecified level (0)java.lang.String
getClassificationDescriptionProperty(int level)
Retrieve the I18N property suitable to build a description for specified classification level.java.lang.String
getClassificationLabel(java.lang.String lang, int level)
Retrieve the I18N label for specified classification level, in the specified language.java.lang.String
getClassificationLabelHtml(java.lang.String lang, int level)
Retrieve an HTML I18N representation of the specified classification level, in the specified language.java.lang.String
getClassificationLabelHtml(java.lang.String lang, int level, boolean inline)
Retrieve an HTML I18N representation of the specified classification level, in the specified language.java.lang.String
getClassificationLabelProperty(int level)
Retrieve the I18N label property suitable to build a label for specified classification level.EnumerateSettings
getClassificationLevelSettings()
Retrieve a settings suitable to edit a classification level.EnumerateSettings
getClassificationLevelSettings(int maxLevel)
Retrieve a settings suitable to edit a classification level.EnumerateSettings
getClassificationLevelSettings(int minLevel, int maxLevel)
Retrieve a settings suitable to edit a classification level.java.lang.String
getClassificationTooltip(int level)
Retrieve the I18N HTML tooltip suitable to present the description for specified classification level (if it exists).int
getEffectiveClearanceLevel(Member mbr)
Retrieve the maximum classification level authorized for the specified member.static ClassificationManager
getInstance()
int
getMaximumLevel()
Retrieve the maximum classification level value possibleboolean
isEnabled()
Check if classification is enabled.boolean
isMemberClearanceEnabled()
Check if member clearance is enabled.void
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.boolean
showClassification(Member mbr)
Check if any UI related to classification should be presented to the specified Member
-
-
-
Field Detail
-
CLASSIFICATION_ADMIN_ACL
public static final java.lang.String CLASSIFICATION_ADMIN_ACL
Name of the ACL authorizing classification level administration- See Also:
- Constant Field Values
-
PROP_ENABLED
public static final java.lang.String PROP_ENABLED
Name of property to check if classification is enabled.- See Also:
- Constant Field Values
-
PROP_MAXIMUM_LEVEL
public static final java.lang.String PROP_MAXIMUM_LEVEL
Name of property from which maximum level is read.- See Also:
- Constant Field Values
-
PROP_BASELINE_LEVEL
public static final java.lang.String PROP_BASELINE_LEVEL
Name of property from which the reference level is read.- See Also:
- Constant Field Values
-
MAXIMUM_LEVEL_DEFAULT
public static final int MAXIMUM_LEVEL_DEFAULT
Default configuration of maximum level.- See Also:
- Constant Field Values
-
BASELINE_LEVEL_DEFAULT
public static final int BASELINE_LEVEL_DEFAULT
Default configuration of the baseline level.- See Also:
- Constant Field Values
-
PROP_MEMBER_CLEARANCE_ENABLED
public static final java.lang.String PROP_MEMBER_CLEARANCE_ENABLED
Name of boolean property used to read whether member clearance is enabled.It includes all associated features, such as publication read right using member authorization, UIs.
- See Also:
- Constant Field Values
-
MEMBER_CLEARANCE_ENABLED_DEFAULT
public static final boolean MEMBER_CLEARANCE_ENABLED_DEFAULT
Default value for member authorization features.- See Also:
- Constant Field Values
-
PROP_PREFIX_FEATURE_MAXIMUM_LEVEL
public static final java.lang.String PROP_PREFIX_FEATURE_MAXIMUM_LEVEL
Name of property prefix from which maximum level of each feature is read.- See Also:
- Constant Field Values
-
PROP_PREFIX_CONSTRAINT_START_LEVEL
public static final java.lang.String PROP_PREFIX_CONSTRAINT_START_LEVEL
Name of property prefix from which the start level used of each constraint is read.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static final ClassificationManager getInstance()
-
propertiesChange
public void propertiesChange(JProperties properties)
Description copied from interface:JPropertiesListener
Invoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getProperties
orchannel.getProperty
.- Specified by:
propertiesChange
in interfaceJPropertiesListener
- Parameters:
properties
- the properties which have been submitted to change
-
isEnabled
public boolean isEnabled()
Check if classification is enabled.- Returns:
- true if maximum level is higher than 0, false otherwise
-
getMaximumLevel
public int getMaximumLevel()
Retrieve the maximum classification level value possible- Returns:
- the value configured with property "classification.max-level"
-
getBaselineLevel
public int getBaselineLevel()
Retrieve the reference classification level to used for unspecified level (0)- Returns:
- the value configured with property "classification.baseline-level", between 1 and
getMaximumLevel()
-
isMemberClearanceEnabled
public boolean isMemberClearanceEnabled()
Check if member clearance is enabled.It includes all associated features, such as publication read right using member clearance level, UIs.
- Returns:
- true if classification and member clearance is enabled, false otherwise.
-
canAccessClassificationAdmin
public boolean canAccessClassificationAdmin(Member mbr)
Check if the specified member is authorized to access classification admin console.- Parameters:
mbr
- the mbr to check- Returns:
- true if authorized false otherwise
-
showClassification
public boolean showClassification(Member mbr)
Check if any UI related to classification should be presented to the specified Member- Parameters:
mbr
- the Member for which check is performed, null accepted- Returns:
- true if classification UI should be displayed, false to hide them completely
-
getClassificationLabelHtml
public java.lang.String getClassificationLabelHtml(java.lang.String lang, int level)
Retrieve an HTML I18N representation of the specified classification level, in the specified language.Implementation detail : the HTML label returned will not be suitable for inline presentation (e.g. inside a span) as it will be presented using a badge. For such use case, use the inline parameter of method
getClassificationLabelHtml(String, int, boolean)
.- Parameters:
lang
- the language in which you want the I18N labellevel
- a classification level- Returns:
- a I18N property name
-
getClassificationLabelHtml
public java.lang.String getClassificationLabelHtml(java.lang.String lang, int level, boolean inline)
Retrieve an HTML I18N representation of the specified classification level, in the specified language.- Parameters:
lang
- the language in which you want the I18N labellevel
- a classification levelinline
- set to true when the label is displayed inside other text (span... ), it will be displayed as a "label". Set to false when displayed for itself it will be displayed as a "badge".- Returns:
- a I18N property name
-
getClassificationLabel
public java.lang.String getClassificationLabel(java.lang.String lang, int level)
Retrieve the I18N label for specified classification level, in the specified language.- Parameters:
lang
- the language in which you want the I18N labellevel
- a classification level- Returns:
- a I18N property name
-
getClassificationLabelProperty
public java.lang.String getClassificationLabelProperty(int level)
Retrieve the I18N label property suitable to build a label for specified classification level.- Parameters:
level
- a classification level- Returns:
- a I18N property name
-
getClassificationLevelSettings
public EnumerateSettings getClassificationLevelSettings()
Retrieve a settings suitable to edit a classification level.- Returns:
- a new EnumerateSettings instance
-
getClassificationLevelSettings
public EnumerateSettings getClassificationLevelSettings(int maxLevel)
Retrieve a settings suitable to edit a classification level.- Parameters:
maxLevel
- the maximum level to display, use 0 (or any negative value) to display all possible levels- Returns:
- a new EnumerateSettings instance
-
getClassificationLevelSettings
public EnumerateSettings getClassificationLevelSettings(int minLevel, int maxLevel)
Retrieve a settings suitable to edit a classification level.- Parameters:
minLevel
- the minimum level to displaymaxLevel
- the maximum level to display, use 0 (or any negative value) to display all possible levels (above the minimum specified)- Returns:
- a new EnumerateSettings instance
-
getClassificationDescriptionProperty
public java.lang.String getClassificationDescriptionProperty(int level)
Retrieve the I18N property suitable to build a description for specified classification level.- Parameters:
level
- a classification level- Returns:
- a I18N property name
-
getClassificationTooltip
public java.lang.String getClassificationTooltip(int level)
Retrieve the I18N HTML tooltip suitable to present the description for specified classification level (if it exists).- Parameters:
level
- a classification level- Returns:
- a I18N property name or empty string if their is no description for this level
-
getEffectiveClearanceLevel
public int getEffectiveClearanceLevel(Member mbr)
Retrieve the maximum classification level authorized for the specified member.- If member clearance is enabled (cf
isMemberClearanceEnabled()
, the maximum clearance level is the effective clearance level of member (cfMember.getEffectiveClearanceLevel()
) or 1 if user is not logged. - If member clearance is disabled, the maximum clearance level is the maximum level configured (cf
getMaximumLevel()
);
- Parameters:
mbr
- the Member for which computation is performed.- Returns:
- a value between 1 and the maximum level configured with property "classification.max-level"
- If member clearance is enabled (cf
-
-