[Bedework-commit] access r101 - in trunk/src/edu/rpi/cmt/access: . test

svnadmin at bedework.org svnadmin at bedework.org
Tue Feb 17 10:06:10 EST 2009


Author: douglm
Date: 2009-02-17 10:06:09 -0500 (Tue, 17 Feb 2009)
New Revision: 101

Modified:
   trunk/src/edu/rpi/cmt/access/Access.java
   trunk/src/edu/rpi/cmt/access/Acl.java
   trunk/src/edu/rpi/cmt/access/test/AccessTest.java
Log:
Access/Users: Change to facilitate move to storing principal path in db rather than owner/creator ids

Modified: trunk/src/edu/rpi/cmt/access/Access.java
===================================================================
--- trunk/src/edu/rpi/cmt/access/Access.java	2009-01-27 19:07:53 UTC (rev 100)
+++ trunk/src/edu/rpi/cmt/access/Access.java	2009-02-17 15:06:09 UTC (rev 101)
@@ -201,14 +201,15 @@
    * access</li>
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param how      Privilege set definign desired access
    * @param aclString String defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess evaluateAccess(AccessPrincipal who, String owner,
+  public CurrentAccess evaluateAccess(AccessPrincipal who,
+                                      AccessPrincipal owner,
                                       Privilege[] how, String aclString,
                                       PrivilegeSet filter)
           throws AccessException {
@@ -220,14 +221,15 @@
   /** convenience method
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param how      Privilege set defining desired access
    * @param aclChars char[] defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess evaluateAccess(AccessPrincipal who, String owner,
+  public CurrentAccess evaluateAccess(AccessPrincipal who,
+                                      AccessPrincipal owner,
                                       Privilege[] how, char[] aclChars,
                                       PrivilegeSet filter)
           throws AccessException {
@@ -238,13 +240,14 @@
   /** convenience method - check for read access
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param aclChars char[] defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess checkRead(AccessPrincipal who, String owner,
+  public CurrentAccess checkRead(AccessPrincipal who,
+                                 AccessPrincipal owner,
                                  char[] aclChars,
                                  PrivilegeSet filter)
           throws AccessException {
@@ -255,13 +258,14 @@
   /** convenience method - check for read write access
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param aclChars char[] defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess checkReadWrite(AccessPrincipal who, String owner,
+  public CurrentAccess checkReadWrite(AccessPrincipal who,
+                                      AccessPrincipal owner,
                                       char[] aclChars,
                                       PrivilegeSet filter)
           throws AccessException {
@@ -272,15 +276,16 @@
   /** convenience method - check for any access
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param aclChars char[] defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess checkAny(AccessPrincipal who, String owner,
-                                      char[] aclChars,
-                                      PrivilegeSet filter)
+  public CurrentAccess checkAny(AccessPrincipal who,
+                                AccessPrincipal owner,
+                                char[] aclChars,
+                                PrivilegeSet filter)
           throws AccessException {
     return new Acl(debug).evaluateAccess(who, owner, privSetAny, aclChars,
                                          filter);
@@ -289,14 +294,15 @@
   /** convenience method - check for given access
    *
    * @param who      Acl.Principal defining who is trying to get access
-   * @param owner    String owner of object
+   * @param owner    owner of object
    * @param priv     int desired access as defined above
    * @param aclChars char[] defining current acls for object
    * @param filter    if not null specifies maximum access
    * @return CurrentAccess   access + allowed/disallowed
    * @throws AccessException
    */
-  public CurrentAccess evaluateAccess(AccessPrincipal who, String owner,
+  public CurrentAccess evaluateAccess(AccessPrincipal who,
+                                      AccessPrincipal owner,
                                       int priv, char[] aclChars,
                                       PrivilegeSet filter)
           throws AccessException {

Modified: trunk/src/edu/rpi/cmt/access/Acl.java
===================================================================
--- trunk/src/edu/rpi/cmt/access/Acl.java	2009-01-27 19:07:53 UTC (rev 100)
+++ trunk/src/edu/rpi/cmt/access/Acl.java	2009-02-17 15:06:09 UTC (rev 101)
@@ -224,7 +224,7 @@
    * @throws AccessException
    */
   public CurrentAccess evaluateAccess(AccessPrincipal who,
-                                      String owner,
+                                      AccessPrincipal owner,
                                       Privilege[] how, char[] acl,
                                       PrivilegeSet filter)
           throws AccessException {
@@ -236,7 +236,7 @@
     decode(acl);
 
     if (authenticated) {
-      isOwner = who.getAccount().equals(owner);
+      isOwner = who.equals(owner);
     }
 
     StringBuilder debugsb = null;

Modified: trunk/src/edu/rpi/cmt/access/test/AccessTest.java
===================================================================
--- trunk/src/edu/rpi/cmt/access/test/AccessTest.java	2009-01-27 19:07:53 UTC (rev 100)
+++ trunk/src/edu/rpi/cmt/access/test/AccessTest.java	2009-02-17 15:06:09 UTC (rev 101)
@@ -166,7 +166,7 @@
   private void tryEvaluateAccess(Principal who, Principal owner,
                                  Privilege[] how,char[] encoded,
                                  boolean expected, String title) throws Throwable {
-    CurrentAccess ca = new Acl(debug).evaluateAccess(who, owner.getAccount(), how,
+    CurrentAccess ca = new Acl(debug).evaluateAccess(who, owner, how,
                                                      encoded, null);
 
     if (debug) {



More information about the Bedework-commit mailing list