ajanta.security.fileacl
Class FileAcl

java.lang.Object
  |
  +--ajanta.security.fileacl.FileAcl
Direct Known Subclasses:
FileSystemAcl

public class FileAcl
extends java.lang.Object

This class provides Access Control List for determining whether user has read and write permission for a given file.

See Also:
ajanta.security.acl

Field Summary
protected  java.util.Hashtable fileAclTable
          HashTable to maintain ACL entries
protected  java.security.acl.Permission inherit
           
protected  java.security.Principal owner
          Owner of the acl entries
protected  ajanta.naming.URN ownerURN
          Owner URN of the acl entries
protected  java.security.acl.Permission read
           
protected  java.lang.String rootPath
          path to the root directory where .acl file can be obtained
protected  java.lang.String urnPart
          this is domain part of file URNs
protected  java.security.acl.Permission write
           
 
Constructor Summary
FileAcl(java.lang.String root)
           
 
Method Summary
 void addFilePermission(ajanta.naming.URN userURN, java.lang.String fileName, java.lang.String perm)
          Add file permission for a given user
protected  boolean checkFilePermission(ajanta.naming.URN userURN, ajanta.naming.URN fileName, java.lang.String perm)
          Check permission for a user
 boolean checkPermission(java.lang.String user, java.lang.String file, java.lang.String perm)
          Check permission for a user
 boolean checkPermission(ajanta.naming.URN userURN, java.lang.String file, java.lang.String perm)
          Check permission for a user
 boolean checkPermission(ajanta.naming.URN userURN, ajanta.naming.URN file, java.lang.String perm)
          Check permission for a user
protected  void createAclEntry(java.lang.String line)
          Create ACL entries : read for "r","write" for "w" and inherit for "i"
 void deleteFilePermission(ajanta.naming.URN userURN, java.lang.String fileName, java.lang.String perm)
          delete file permission for a given user
protected  void initAclTable()
          It reads .acl file under "root" directory and initializes the ACL table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ownerURN

protected ajanta.naming.URN ownerURN
Owner URN of the acl entries


rootPath

protected java.lang.String rootPath
path to the root directory where .acl file can be obtained


owner

protected java.security.Principal owner
Owner of the acl entries


read

protected java.security.acl.Permission read

write

protected java.security.acl.Permission write

inherit

protected java.security.acl.Permission inherit

fileAclTable

protected java.util.Hashtable fileAclTable
HashTable to maintain ACL entries


urnPart

protected java.lang.String urnPart
this is domain part of file URNs

Constructor Detail

FileAcl

public FileAcl(java.lang.String root)
Parameters:
root - path to the root directory where .acl file can be obtained
Method Detail

initAclTable

protected void initAclTable()
It reads .acl file under "root" directory and initializes the ACL table. An entry in .acl file can be
/home/grad25/rsingh/.ajanta/servers/calendarServer/HashTableDB rw URN:ans:fourier.cs.umn.edu/rsingh
name of the file "rwi" user1-URN user2-URN .....
r - read , w - write, i - inherit


createAclEntry

protected void createAclEntry(java.lang.String line)
Create ACL entries : read for "r","write" for "w" and inherit for "i"


deleteFilePermission

public void deleteFilePermission(ajanta.naming.URN userURN,
                                 java.lang.String fileName,
                                 java.lang.String perm)
delete file permission for a given user

Parameters:
userURN - urn of the user who'e permission is being deleted
fileName - name of the file
perm - permission string "read","write" or "inherit"

addFilePermission

public void addFilePermission(ajanta.naming.URN userURN,
                              java.lang.String fileName,
                              java.lang.String perm)
Add file permission for a given user

Parameters:
userURN - urn of the user who'e permission is being added
fileName - name of the file
perm - permission string "read","write" or "inherit"

checkFilePermission

protected boolean checkFilePermission(ajanta.naming.URN userURN,
                                      ajanta.naming.URN fileName,
                                      java.lang.String perm)
Check permission for a user

Parameters:
userURN - urn of the user
fileName - urn of the file ( urn:ans:root/somefile )

checkPermission

public boolean checkPermission(java.lang.String user,
                               java.lang.String file,
                               java.lang.String perm)
Check permission for a user


checkPermission

public boolean checkPermission(ajanta.naming.URN userURN,
                               java.lang.String file,
                               java.lang.String perm)
Check permission for a user

Parameters:
userURN - urn of the user

checkPermission

public boolean checkPermission(ajanta.naming.URN userURN,
                               ajanta.naming.URN file,
                               java.lang.String perm)
Check permission for a user

Parameters:
userURN - urn of the user