| 1 16 package org.outerj.daisy.repository.commonimpl.acl; 17 18 import org.outerj.daisy.repository.acl.AccessManager; 19 import org.outerj.daisy.repository.acl.Acl; 20 import org.outerj.daisy.repository.acl.AclResultInfo; 21 import org.outerj.daisy.repository.acl.AclPermission; 22 import org.outerj.daisy.repository.commonimpl.AuthenticatedUser; 23 import org.outerj.daisy.repository.Document; 24 import org.outerj.daisy.repository.RepositoryException; 25 import org.outerj.daisy.repository.VariantKey; 26 import org.outerj.daisy.repository.variant.Branch; 27 import org.outerj.daisy.repository.variant.Language; 28 29 public class AccessManagerImpl implements AccessManager { 30 private CommonAccessManager delegate; 31 private AuthenticatedUser user; 32 33 public AccessManagerImpl(CommonAccessManager delegate, AuthenticatedUser user) { 34 this.delegate = delegate; 35 this.user = user; 36 } 37 38 public Acl getLiveAcl() throws RepositoryException { 39 return delegate.getLiveAcl(user); 40 } 41 42 public Acl getStagingAcl() throws RepositoryException { 43 return delegate.getStagingAcl(user); 44 } 45 46 public void copyStagingToLive() throws RepositoryException { 47 delegate.copyStagingToLive(user); 48 } 49 50 public void copyLiveToStaging() throws RepositoryException { 51 delegate.copyLiveToStaging(user); 52 } 53 54 public AclResultInfo getAclInfo(Document document) throws RepositoryException { 55 return delegate.getAclInfoOnLive(user, user.getId(), user.getActiveRoleIds(), document); 56 } 57 58 public AclResultInfo getAclInfoOnLive(long userId, long[] roleIds, long documentId) throws RepositoryException { 59 return getAclInfoOnLive(userId, roleIds, documentId, Branch.MAIN_BRANCH_ID, Language.DEFAULT_LANGUAGE_ID); 60 } 61 62 public AclResultInfo getAclInfoOnStaging(long userId, long[] roleIds, long documentId) throws RepositoryException { 63 return getAclInfoOnStaging(userId, roleIds, documentId, Branch.MAIN_BRANCH_ID, Language.DEFAULT_LANGUAGE_ID); 64 } 65 66 public AclResultInfo getAclInfoOnLive(long userId, long[] roleIds, long documentId, long branchId, long languageId) throws RepositoryException { 67 return delegate.getAclInfoOnLive(user, userId, roleIds, documentId, branchId, languageId); 68 } 69 70 public AclResultInfo getAclInfoOnLive(long userId, long[] roleIds, VariantKey key) throws RepositoryException { 71 return getAclInfoOnLive(userId, roleIds, key.getDocumentId(), key.getBranchId(), key.getLanguageId()); 72 } 73 74 public AclResultInfo getAclInfoOnStaging(long userId, long[] roleIds, long documentId, long branchId, long languageId) throws RepositoryException { 75 return delegate.getAclInfoOnStaging(user, userId, roleIds, documentId, branchId, languageId); 76 } 77 78 public AclResultInfo getAclInfoOnStaging(long userId, long[] roleIds, VariantKey key) throws RepositoryException { 79 return getAclInfoOnStaging(userId, roleIds, key.getDocumentId(), key.getBranchId(), key.getLanguageId()); 80 } 81 82 public AclResultInfo getAclInfoOnLive(long userId, long[] roleIds, Document document) throws RepositoryException { 83 return delegate.getAclInfoOnLive(user, userId, roleIds, document); 84 } 85 86 public AclResultInfo getAclInfoOnStaging(long userId, long[] roleIds, Document document) throws RepositoryException { 87 return delegate.getAclInfoOnStaging(user, userId, roleIds, document); 88 } 89 90 public long[] filterDocumentTypes(long[] documentTypeIds, long collectionId) throws RepositoryException { 91 return delegate.filterDocumentTypes(user, documentTypeIds, collectionId); 92 } 93 94 public VariantKey[] filterDocuments(VariantKey[] variantKeys) throws RepositoryException { 95 return delegate.filterDocuments(user, variantKeys, AclPermission.READ_LIVE); 96 } 97 98 public VariantKey[] filterDocuments(VariantKey[] variantKeys, AclPermission permission) throws RepositoryException { 99 return delegate.filterDocuments(user, variantKeys, permission); 100 } 101 } 102 | Popular Tags |