title: How to develop Custom ACL to a node in CQ
body: <p>Can any one help me how can i develop custom ACL to a node in CQ/AEM projects I refer these sites <a href="http://wiki.apache.org/jackrabbit/AccessControl" rel="nofollow">http://wiki.apache.org/jackrabbit/AccessControl</a>, <a href="http://wemcode.wemblog.com/add-acl-to-node" rel="nofollow">http://wemcode.wemblog.com/add-acl-to-node</a> </p>
  
  <pre><code>import javax.jcr.Node;
  import javax.jcr.NodeIterator;
  import javax.jcr.Repository;
  import javax.jcr.Session;
  import javax.jcr.security.*;
  import javax.jcr.*;
  
  
  
  public class ManageAccesscontrol{
  
  public void test(){
  
  Request.getSession(false);
  
  JackrabbitSession js = (JackrabbitSession)session;
  
   AccessControlManager aMgr = jackrabbitSession.getAccessControlManager();
  
   // create a privilege set with jcr:all
   Privilege[] privileges = new Privilege[] 
   {    aMgr.privilegeFromName(Privilege.JCR_ALL) };
   AccessControlList acl;
   try {
  // get first applicable policy (for nodes w/o a policy)
  acl = aMgr.getApplicablePolicies(path).nextAccessControlPolicy();
  } catch (NoSuchElementException e) {
  // else node already has a policy, get that one
  acl = aMgr.getPolicies(path)[0];
  }
  // remove all existing entries
   for (AccessControlEntry e : acl.getAccessControlEntries()) {
  acl.removeAccessControlEntry(e);
  }
  // add a new one for the special "everyone" principal
  acl.addAccessControlEntry(EveryonePrincipal.getInstance(), privileges);
  
   // the policy must be re-set
  aMgr.setPolicy(path, acl);
  
  // and the session must be saved for the changes to be applied
  session.save();
  }
  }
  </code></pre>
  
  <p>still am unable to fix SESSION. 
  If any one know about this help me  plz...</p>