Skip to content

Instantly share code, notes, and snippets.

@pentaho-nbaker
Created December 23, 2014 04:15
Show Gist options
  • Select an option

  • Save pentaho-nbaker/05ff58909288db6d0791 to your computer and use it in GitHub Desktop.

Select an option

Save pentaho-nbaker/05ff58909288db6d0791 to your computer and use it in GitHub Desktop.
package org.pentaho.platform.api.repository2.unified;
import java.util.EnumSet;
/**
* <p>The interface for operations over ACL nodes.</p>
*
* <p>Certain entities, such as data sources, are stored in areas of the repository in which non-admin users have no
* natural access. In order to provide ACLs on these entities surrogate nodes are created which store the ACLs instead.
* Implementations of this class are responsible for storing and querying these surrogate ACL nodes.</p>
*
*
* @author Andrey Khayrutdinov
* @author Nick Baker
*/
public interface IAclNodeHelper {
/**
* Returns <code>true</code> if the current user has access to <code>repositoryFile</code> by way of ACL node.
*
* @param repositoryFile file for which to check access by ACL node
* @param permissions EnumSet of permissions to check against the repositoryFile
* @return <code>true</code> if the user can access the Repository File
*/
boolean hasAccess( RepositoryFile repositoryFile, EnumSet<RepositoryFilePermission> permissions );
/**
* Returns <code>true</code> if the current user has access to <code>repositoryFile</code> by way of ACL node.
*
* @param repositoryFile file for which to check access by ACL node
* @param principal user to check for access
* @param permissions EnumSet of permissions to check against the repositoryFile
* @return <code>true</code> if the user can access the Repository File
*/
boolean hasAccess( RepositoryFile repositoryFile, String principal, EnumSet<RepositoryFilePermission> permissions );
/**
* Returns an ACL for <code>repositoryFile</code>. If none exists, <code>null</code> is returned. <b>Note:</b> this
* method should be invoked with 'repository admin' privileges.
*
* @param repositoryFile file for which to retrieve ACLs for
* @return ACL rules if exist or <code>null</code> otherwise
*/
RepositoryFileAcl getAclFor( RepositoryFile repositoryFile );
/**
* Sets <code>acl</code> for <code>repositoryFile</code>. If a ACL node does not exist, it is created. If <code>acl</code> is
* <code>null</code>, the ACL node is removed.
*
* @param repositoryFile data source
* @param acl an ACL rules for the data source
*/
void setAclFor( RepositoryFile repositoryFile, RepositoryFileAcl acl );
/**
* Deletes the ACL node associated with the <code>repositoryFile</code> if it exists.
*
* @param repositoryFile data source
*/
void removeAclFor( RepositoryFile repositoryFile );
/**
* Returns a path where ACL nodes are created.
*
* @return ACL nodes folder's path
*/
String getAclNodeFolder();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment