Interface AuthorExecutor


  • @Role
    public interface AuthorExecutor
    Allow executing some code with the right of a provided user.
    Since:
    8.3RC1
    Version:
    $Id: f0324d8b8ebe88305c409b927d7295a4e29a0fba $
    • Method Detail

      • call

        default <V> V call​(Callable<V> callable,
                           DocumentReference authorReference,
                           DocumentReference sourceReference)
                    throws Exception
        Execute the passed Callable with the rights of the passed user.
        Type Parameters:
        V - the result type of method call
        Parameters:
        callable - the task to execute
        authorReference - the user to check rights on
        sourceReference - the reference of the document associated with the Callable (which will be used to test the author right)
        Returns:
        computed result
        Throws:
        Exception - if unable to compute a result
        Since:
        10.11RC1
      • before

        default AutoCloseable before​(DocumentReference authorReference,
                                     DocumentReference sourceReference)
        Setup the context so that following code is executed with provided user rights.
         
         try (AutoCloseable context = this.executor.before(author, sourceDocument)) {
           ...
         }
         
         
        Parameters:
        authorReference - the user to check rights on
        sourceReference - the reference of the document associated with the Callable (which will be used to test the author right)
        Returns:
        the context to restore
        Since:
        10.11RC1
        See Also:
        after(AutoCloseable)