Class SecurableRequestCache


  • public class SecurableRequestCache
    extends Object
    A common tool to handled securable implementation with a request cache.

    Indeed, the computing about secured access can be costly about performances and using a request cache could be interesting when access authorization is computed several times for a same entity into the context of a same request.

    Author:
    Yohann Chastagnier
    • Method Detail

      • canBeAccessedBy

        public static boolean canBeAccessedBy​(User user,
                                              String uniqueIdentifier,
                                              Predicate<User> canBeAccessedBy)
        Indicates if the given user can access the data managed by the object instance.
        Parameters:
        user - a user in Silverpeas.
        uniqueIdentifier - a unique identifier.
        canBeAccessedBy - the supplier of the result of access authorization computing.
        Returns:
        true if the user can access the data managed by this instance, false otherwise.
      • canBeModifiedBy

        public static boolean canBeModifiedBy​(User user,
                                              String uniqueIdentifier,
                                              Predicate<User> canBeModifiedBy)
        Indicates if the given user can modify the data managed by the object instance.
        Parameters:
        user - a user in Silverpeas.
        uniqueIdentifier - a unique identifier.
        canBeModifiedBy - the supplier of the result of access authorization computing.
        Returns:
        true if the user can modify the data managed by this instance, false otherwise.
      • canBeDeletedBy

        public static boolean canBeDeletedBy​(User user,
                                             String uniqueIdentifier,
                                             Predicate<User> canBeDeletedBy)
        Indicates if the given user can delete the data managed by the object instance.
        Parameters:
        user - a user in Silverpeas.
        uniqueIdentifier - a unique identifier.
        canBeDeletedBy - the supplier of the result of access authorization computing.
        Returns:
        true if the user can delete the data managed by this instance, false otherwise.
      • clear

        public static void clear​(String uniqueIdentifier)
        Clears the cache linked to an entity represented by the given unique identifier.
        Parameters:
        uniqueIdentifier - an identifier which represents a unique entity.