Class ClassificationManager

java.lang.Object
com.jalios.jcms.security.classified.ClassificationManager
All Implemented Interfaces:
JPropertiesListener

public class ClassificationManager extends Object implements JPropertiesListener
Manager class for all classification related controls.
Since:
10.0.8 / JCMS-10746
  • Field Details

    • CLASSIFICATION_ADMIN_ACL

      public static final String CLASSIFICATION_ADMIN_ACL
      Name of the ACL authorizing classification level administration
      See Also:
    • PROP_ENABLED

      public static final String PROP_ENABLED
      Name of property to check if classification is enabled.
      See Also:
    • PROP_MAXIMUM_LEVEL

      public static final String PROP_MAXIMUM_LEVEL
      Name of property from which maximum level is read.
      See Also:
    • PROP_BASELINE_LEVEL

      public static final String PROP_BASELINE_LEVEL
      Name of property from which the reference level is read.
      See Also:
    • MAXIMUM_LEVEL_DEFAULT

      public static final int MAXIMUM_LEVEL_DEFAULT
      Default configuration of maximum level.
      See Also:
    • BASELINE_LEVEL_DEFAULT

      public static final int BASELINE_LEVEL_DEFAULT
      Default configuration of the baseline level.
      See Also:
    • PROP_MEMBER_CLEARANCE_ENABLED

      public static final 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:
    • MEMBER_CLEARANCE_ENABLED_DEFAULT

      public static final boolean MEMBER_CLEARANCE_ENABLED_DEFAULT
      Default value for member authorization features.
      See Also:
    • PROP_PREFIX_FEATURE_MAXIMUM_LEVEL

      public static final String PROP_PREFIX_FEATURE_MAXIMUM_LEVEL
      Name of property prefix from which maximum level of each feature is read.
      See Also:
    • PROP_PREFIX_CONSTRAINT_START_LEVEL

      public static final String PROP_PREFIX_CONSTRAINT_START_LEVEL
      Name of property prefix from which the start level used of each constraint is read.
      See Also:
  • Method Details

    • 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 or channel.getProperty.

      Specified by:
      propertiesChange in interface JPropertiesListener
      Parameters:
      properties - the properties which have been submitted to change
    • loadProperties

      public void loadProperties()
    • 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.
    • showMemberClearanceLevel

      public boolean showMemberClearanceLevel(Member mbr)
      Check if member clearance level field should be displayed to the specified member.
      Parameters:
      mbr - the mbr to check
      Returns:
      true if member is authorized to see member clearance (provided feature is enabled), false otherwise.
      Since:
      10.0.9 / JCMS-11079
    • 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 String getClassificationLabelHtml(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 label
      level - a classification level
      Returns:
      a I18N property name
    • getClassificationLabelHtml

      public String getClassificationLabelHtml(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 label
      level - a classification level
      inline - 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 String getClassificationLabel(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 label
      level - a classification level
      Returns:
      a I18N property name
    • getClassificationLabelProperty

      public 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 display
      maxLevel - 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 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 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
    • getClassificationSubtitle

      public String getClassificationSubtitle(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.

      Parameters:
      mbr - the Member for which computation is performed.
      Returns:
      a value between 1 and the maximum level configured with property "classification.max-level"