All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jnfs.security.UnixStylePermissionGranter

java.lang.Object
   |
   +----jnfs.security.UnixStylePermissionGranter

public abstract class UnixStylePermissionGranter
extends Object
implements PermissionGranter
This permission granter uses unix-style modes and the user/group/world access-control schematics. Subclasses must provide a way to retrieve mode, owner, group and membership info.

Version:
$Id: UnixStylePermissionGranter.java,v 1.38 1997/05/20 19:16:20 mjr Exp $
Author:
Michael John Radwin

Variable Index

 o groupPrefix
The prefix prepended to all groupnames before they are used to instantiate a GroupImpl.
 o S_IRGRP
Read by group.
 o S_IROTH
Read by others.
 o S_IRUSR
Read by owner.
 o S_IRWXG
Read, write, execute by group.
 o S_IRWXO
Read, write, execute (search) by others.
 o S_IRWXU
Read, write, execute by owner.
 o S_ISGID
Set group id on execution.
 o S_ISUID
Set user id on execution.
 o S_ISVTX
Save text image after execution.
 o S_IWGRP
Write by group.
 o S_IWOTH
Write by others.
 o S_IWUSR
Write by owner.
 o S_IXGRP
Execute by group.
 o S_IXOTH
Execute by others.
 o S_IXUSR
Execute (search if directory) by owner.
 o users
Used to obtain references to FileSystemUsers.

Constructor Index

 o UnixStylePermissionGranter(UserTable)
Constructs a permission granter with the specified user table.

Method Index

 o checkPermission(Principal, Permission, File)
Determines if user has permission for file.
 o chmod(String, int)
Changes the mode of pathname to mode.
 o chown(String, String, String)
Changes the ownership of pathname to owner and group membership to group.
 o createAcl(String, int, Principal, Group)
Creates an ACL for pathname for the given owner and group according to mode.
 o getAccessControl(File)
Gets existring permissions on file.
 o getAcl(String)
Gets the ACL for pathname based on information provided by the underlying unix file system.
 o getAttributesPermission()
Returns the global permission represening "attributes" access
 o getDeletePermission()
Returns the global permission represening "delete" access
 o getExecutePermission()
Returns the global permission represening "execute" access
 o getGroup(String)
Gets the principal named name
 o getListPermission()
Returns the global permission represening "list" access
 o getPrincipal(String)
Gets the principal named name
 o getReadPermission()
Returns the global permission represening "read" access
 o getRenamePermission()
Returns the global permission represening "rename" access
 o getStickyPermission()
Returns the global permission represening "sticky" access
 o getWritePermission()
Returns the global permission represening "write" access
 o group(String)
Returns the name of the group associated with pathname.
 o invalidateCache(File)
If ACL information for file is cached, invalidates it.
 o members(String)
Returns the group members of group groupname.
 o mode(String)
Returns the Unix mode bits associated with pathname.
 o owner(String)
Returns the name of the owner of pathname.
 o setAccessControl(Principal, File, Acl)
Replaces any existing permissions on file with the new permissions in acl.
 o setDefaultAccessControl(Principal, File)
Replaces any existing permissions on file with the default permissions for newOwner.
 o worldGroup()
Returns the group containing all FileSystemUsers.

Variables

 o S_IRWXU
 public static final int S_IRWXU
Read, write, execute by owner.

 o S_IRUSR
 public static final int S_IRUSR
Read by owner.

 o S_IWUSR
 public static final int S_IWUSR
Write by owner.

 o S_IXUSR
 public static final int S_IXUSR
Execute (search if directory) by owner.

 o S_IRWXG
 public static final int S_IRWXG
Read, write, execute by group.

 o S_IRGRP
 public static final int S_IRGRP
Read by group.

 o S_IWGRP
 public static final int S_IWGRP
Write by group.

 o S_IXGRP
 public static final int S_IXGRP
Execute by group.

 o S_IRWXO
 public static final int S_IRWXO
Read, write, execute (search) by others.

 o S_IROTH
 public static final int S_IROTH
Read by others.

 o S_IWOTH
 public static final int S_IWOTH
Write by others.

 o S_IXOTH
 public static final int S_IXOTH
Execute by others.

 o S_ISVTX
 public static final int S_ISVTX
Save text image after execution.

If a directory is writable and has S_ISVTX (the sticky bit) set, files within that directory can be removed or renamed only if one or more of the following is true (see unlink(2) and rename(2)):

 o S_ISUID
 public static final int S_ISUID
Set user id on execution.

 o S_ISGID
 public static final int S_ISGID
Set group id on execution.

 o users
 protected UserTable users
Used to obtain references to FileSystemUsers.

 o groupPrefix
 protected final String groupPrefix
The prefix prepended to all groupnames before they are used to instantiate a GroupImpl. Group names do not use the prefix when inserted into the group cache.

Constructors

 o UnixStylePermissionGranter
 public UnixStylePermissionGranter(UserTable users)
Constructs a permission granter with the specified user table.

Methods

 o mode
 protected abstract int mode(String pathname) throws IOException
Returns the Unix mode bits associated with pathname.

Throws: IOException
if an I/O error occurs.
Throws: FileNotFoundException
if pathname does not exist.
 o owner
 protected abstract String owner(String pathname) throws IOException
Returns the name of the owner of pathname.

Throws: IOException
if an I/O error occurs.
Throws: FileNotFoundException
if pathname does not exist.
 o group
 protected abstract String group(String pathname) throws IOException
Returns the name of the group associated with pathname.

Throws: IOException
if an I/O error occurs.
Throws: FileNotFoundException
if pathname does not exist.
 o members
 protected abstract String[] members(String groupname) throws IOException
Returns the group members of group groupname.

Throws: IOException
if the group does not exist.
 o chmod
 protected abstract void chmod(String pathname,
                               int mode) throws IOException
Changes the mode of pathname to mode.

Throws: IOException
if an I/O error occurs.
Throws: FileNotFoundException
if pathname does not exist.
 o chown
 protected abstract void chown(String pathname,
                               String owner,
                               String group) throws IOException
Changes the ownership of pathname to owner and group membership to group. If either owner or group are null, that permission is not changed. If both are null, nothing happens.

Throws: IOException
if an I/O error occurs.
Throws: FileNotFoundException
if pathname does not exist.
 o worldGroup
 public Group worldGroup()
Returns the group containing all FileSystemUsers.

 o getAccessControl
 public Acl getAccessControl(File file) throws IOException
Gets existring permissions on file. Permissions on a particular file don't necessarily map 1-to-1 to who can access the file or not because there may be security restrictions on the parent directories of the file that override this file's settings.

Returns:
the ACL for this file if the user can see it; null otherwise.
Throws: IOException
if an I/O error occurs.
 o setAccessControl
 public boolean setAccessControl(Principal user,
                                 File file,
                                 Acl acl) throws IOException, NotOwnerException
Replaces any existing permissions on file with the new permissions in acl.

Returns:
true if the permissions were set; false otherwise.
Throws: IOException
if an I/O error occurs.
Throws: NotOwnerException
if user is not an owner of file.
 o setDefaultAccessControl
 public boolean setDefaultAccessControl(Principal newOwner,
                                        File file) throws IOException
Replaces any existing permissions on file with the default permissions for newOwner. Changes the ownership to the new owner.

Returns:
true if the permissions were set; false otherwise.
Throws: IOException
if an I/O error occurs.
 o invalidateCache
 public boolean invalidateCache(File file)
If ACL information for file is cached, invalidates it.

Returns:
true if the ACL information was in the cache; false otherwise.
 o checkPermission
 public boolean checkPermission(Principal user,
                                Permission permission,
                                File file) throws IOException
Determines if user has permission for file.

Returns:
true if user has the specified permission; false otherwise.
Throws: IOException
if an I/O error occurs.
 o getPrincipal
 protected Principal getPrincipal(String name)
Gets the principal named name

 o getGroup
 protected Group getGroup(String name) throws IOException
Gets the principal named name

Throws: IOException
if an I/O error occurs.
 o getAcl
 protected Acl getAcl(String pathname) throws IOException
Gets the ACL for pathname based on information provided by the underlying unix file system. Caches whatever return value it provides.

Throws: IOException
if an I/O error occurs.
See Also:
createAcl
 o createAcl
 protected Acl createAcl(String pathname,
                         int mode,
                         Principal owner,
                         Group grp)
Creates an ACL for pathname for the given owner and group according to mode. Does not cache return value or use underlying filesytem for any info.

 o getReadPermission
 public Permission getReadPermission()
Returns the global permission represening "read" access

 o getWritePermission
 public Permission getWritePermission()
Returns the global permission represening "write" access

 o getExecutePermission
 public Permission getExecutePermission()
Returns the global permission represening "execute" access

 o getDeletePermission
 public Permission getDeletePermission()
Returns the global permission represening "delete" access

 o getAttributesPermission
 public Permission getAttributesPermission()
Returns the global permission represening "attributes" access

 o getListPermission
 public Permission getListPermission()
Returns the global permission represening "list" access

 o getRenamePermission
 public Permission getRenamePermission()
Returns the global permission represening "rename" access

 o getStickyPermission
 public Permission getStickyPermission()
Returns the global permission represening "sticky" access


All Packages  Class Hierarchy  This Package  Previous  Next  Index