use of org.pentaho.platform.plugin.services.importexport.exportManifest.bindings.EntityAcl in project pentaho-platform by pentaho.
the class ExportManifestEntity method getRepositoryFileAcl.
/**
* Helper method for importing. Returns a FileRepositoryAcl object for the the ExportManifestEntity. Will return null
* if there is no EntityAcl present.
*
* @return RepositoryFile
*/
public RepositoryFileAcl getRepositoryFileAcl() throws ExportManifestFormatException {
RepositoryFileAcl repositoryFileAcl;
EntityAcl entityAcl = getEntityAcl();
if (entityAcl == null) {
return null;
}
ArrayList<RepositoryFileAce> repositoryFileAces = new ArrayList<RepositoryFileAce>();
RepositoryFileSid rfs;
for (EntityAcl.Aces ace : entityAcl.getAces()) {
rfs = getSid(ace.getRecipient(), ace.getRecipientType());
HashSet<RepositoryFilePermission> permissionSet = new HashSet<RepositoryFilePermission>();
for (String permission : ace.getPermissions()) {
permissionSet.add(getPermission(permission));
}
RepositoryFileAce repositoryFileAce = new RepositoryFileAce(rfs, EnumSet.copyOf(permissionSet));
repositoryFileAces.add(repositoryFileAce);
}
repositoryFileAcl = new RepositoryFileAcl("", getSid(entityAcl.getOwner(), entityAcl.getOwnerType()), entityAcl.isEntriesInheriting(), repositoryFileAces);
return repositoryFileAcl;
}
use of org.pentaho.platform.plugin.services.importexport.exportManifest.bindings.EntityAcl in project pentaho-platform by pentaho.
the class ExportManifestEntity method createEntityAcl.
private void createEntityAcl(String userId) {
entityAcl = new EntityAcl();
entityAcl.setEntriesInheriting(true);
}
use of org.pentaho.platform.plugin.services.importexport.exportManifest.bindings.EntityAcl in project pentaho-platform by pentaho.
the class ExportManifestEntity method createEntityAcl.
private void createEntityAcl(RepositoryFileAcl repositoryFileAcl) {
DefaultTenantedPrincipleNameResolver nameResolver = new DefaultTenantedPrincipleNameResolver();
if (repositoryFileAcl == null) {
return;
}
entityAcl = new EntityAcl();
entityAcl.setEntriesInheriting(repositoryFileAcl.isEntriesInheriting());
entityAcl.setOwner(nameResolver.getPrincipleName(repositoryFileAcl.getOwner().getName()));
entityAcl.setOwnerType(repositoryFileAcl.getOwner().getType().name());
List<EntityAcl.Aces> aces = entityAcl.getAces();
aces.clear();
for (RepositoryFileAce repositoryFileAce : repositoryFileAcl.getAces()) {
EntityAcl.Aces ace = new EntityAcl.Aces();
ace.setRecipient(nameResolver.getPrincipleName(repositoryFileAce.getSid().getName()));
ace.setRecipientType(repositoryFileAce.getSid().getType().name());
List<String> permissions = ace.getPermissions();
for (RepositoryFilePermission permission : repositoryFileAce.getPermissions()) {
permissions.add(permission.toString());
}
aces.add(ace);
}
}
Aggregations