Class AbstractAccessController<T>

    • Constructor Detail

      • AbstractAccessController

        public AbstractAccessController()
    • Method Detail

      • filterAuthorizedByUser

        public Stream<T> filterAuthorizedByUser​(Collection<T> objects,
                                                String userId)
        Description copied from interface: AccessController
        Filters the given object list in order to keep those the specified user is authorized on.

        This aim of this method is to be as efficient as possible on large volume of data.

        Specified by:
        filterAuthorizedByUser in interface AccessController<T>
        Parameters:
        objects - the objects to filter.
        userId - the unique identifier of the user.
        Returns:
        true if access is granted - false otherwise.
      • filterAuthorizedByUser

        public Stream<T> filterAuthorizedByUser​(Collection<T> objects,
                                                String userId,
                                                AccessControlContext context)
        Description copied from interface: AccessController
        Filters the given object list in order to keep those the specified user is authorized on.

        This aim of this method is to be as efficient as possible on large volume of data.

        Specified by:
        filterAuthorizedByUser in interface AccessController<T>
        Parameters:
        objects - the objects to filter.
        userId - the unique identifier of the user.
        context - the context in which the object is accessed.
        Returns:
        true if access is granted - false otherwise.
      • isUserAuthorized

        public final boolean isUserAuthorized​(String userId,
                                              T object)
        Description copied from interface: AccessController
        Checks if the specified user may access the specified object.
        Specified by:
        isUserAuthorized in interface AccessController<T>
        Parameters:
        userId - the unique identifier of the user.
        object - the object to be accessed.
        Returns:
        true if access is granted - false otherwise.
      • getUserRoles

        public final Set<SilverpeasRole> getUserRoles​(String userId,
                                                      T object,
                                                      AccessControlContext context)
        Description copied from interface: AccessController
        Gets the user roles about the aimed object and by taking in account the context of the access. After a first call, user role are cached (REQUEST live time) in order to increase the performances in case of several call on the same user and object.
        Specified by:
        getUserRoles in interface AccessController<T>
        Parameters:
        userId - the unique identifier of the user.
        object - the object to be accessed.
        context - the context in which the object is accessed.
        Returns:
        the role the user has about a resource and according to a context.
      • fillUserRoles

        protected void fillUserRoles​(Set<SilverpeasRole> userRoles,
                                     AccessControlContext context,
                                     String userId,
                                     T object)
        This method must fill user roles into the given container by taking in account the other parameters.
        Parameters:
        userRoles -
        context -
        userId -
        object -