1 5 package org.exoplatform.portlets.content; 6 7 import javax.faces.context.FacesContext; 8 import org.exoplatform.portlets.content.explorer.component.model.NodeDescriptor; 9 15 public class FileACL implements ACL { 16 private String user_ ; 17 private String readRole_ ; 18 private String writeRole_ ; 19 20 public FileACL(String user, String readRole, String writeRole) { 21 user_ = user ; 22 readRole_ = readRole ; 23 writeRole_ = writeRole ; 24 } 25 26 public boolean hasReadRole(NodeDescriptor node) { 27 if(readRole_ == null || readRole_.length() == 0 || "any".equals(readRole_)) { 28 return true ; 29 } 30 FacesContext context = FacesContext.getCurrentInstance() ; 31 return context.getExternalContext().isUserInRole(readRole_) ; 32 } 33 34 public boolean hasWriteRole(NodeDescriptor node) { 35 if(writeRole_ == null || writeRole_.length() == 0 || "any".equals(writeRole_)) { 36 return true ; 37 } 38 FacesContext context = FacesContext.getCurrentInstance() ; 39 return context.getExternalContext().isUserInRole(writeRole_) ; 40 } 41 } | Popular Tags |