org.apache.james.imapserver
Interface ACL

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
ACLMailbox

public interface ACL
extends java.io.Serializable

Interface for objects representing for an IMAP4rev1 Access Control List. There should be one instance of this class per open mailbox. An Access control list, for IMAP purposes, is a list of pairs.

The standard rights in RFC2086 are:
l - lookup (mailbox is visible to LIST/LSUB commands)
r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL, SEARCH, COPY from mailbox)
s - keep seen/unseen information across sessions (STORE SEEN flag)
w - write (STORE flags other than SEEN and DELETED)
i - insert (perform APPEND, COPY into mailbox)
p - post (send mail to submission address for mailbox, not enforced by IMAP4 itself)
c - create (CREATE new sub-mailboxes in any implementation-defined hierarchy)
d - delete (STORE DELETED flag, perform EXPUNGE)
a - administer (perform SETACL)

References: rfc 2060, rfc 2086

Version:
0.1 on 14 Dec 2000
Author:
Charles Benett

Field Summary
static char ADD_RIGHTS
           
static char ADMIN_RIGHTS
           
static char CREATE_RIGHTS
           
static char DELETE_RIGHTS
           
static char INSERT_RIGHTS
           
static char KEEP_SEEN_RIGHTS
           
static char LOOKUP_RIGHTS
           
static char POST_RIGHTS
           
static char READ_RIGHTS
           
static char REMOVE_RIGHTS
           
static char[] RIGHTS
           
static char WRITE_RIGHTS
           
 
Method Summary
 java.lang.String getAllRights(java.lang.String getter)
          Retrieves a String of one or more who have rights in this ACL
 java.lang.String getOptionalRights(java.lang.String getter, java.lang.String identity)
          Retrieve rights which may be granted to the specified identity.
 java.lang.String getRequiredRights(java.lang.String getter, java.lang.String identity)
          Retrieve rights which will always be granted to the specified identity.
 java.lang.String getRights(java.lang.String getter, java.lang.String identity)
          Retrieve access rights for a specific identity.
 java.util.Set getUsersWithLookupRights()
           
 java.util.Set getUsersWithReadRights()
           
 boolean hasAdminRights(java.lang.String username)
           
 boolean hasDeleteRights(java.lang.String username)
           
 boolean hasInsertRights(java.lang.String username)
           
 boolean hasKeepSeenRights(java.lang.String username)
           
 boolean hasReadRights(java.lang.String username)
          Helper boolean methods.
 boolean hasWriteRights(java.lang.String username)
           
 boolean setRights(java.lang.String setter, java.lang.String identifier, java.lang.String modification)
          Store access rights for a given identity.
 

Field Detail

LOOKUP_RIGHTS

public static final char LOOKUP_RIGHTS

READ_RIGHTS

public static final char READ_RIGHTS

KEEP_SEEN_RIGHTS

public static final char KEEP_SEEN_RIGHTS

WRITE_RIGHTS

public static final char WRITE_RIGHTS

INSERT_RIGHTS

public static final char INSERT_RIGHTS

POST_RIGHTS

public static final char POST_RIGHTS

CREATE_RIGHTS

public static final char CREATE_RIGHTS

DELETE_RIGHTS

public static final char DELETE_RIGHTS

ADMIN_RIGHTS

public static final char ADMIN_RIGHTS

ADD_RIGHTS

public static final char ADD_RIGHTS

REMOVE_RIGHTS

public static final char REMOVE_RIGHTS

RIGHTS

public static final char[] RIGHTS
Method Detail

setRights

public boolean setRights(java.lang.String setter,
                         java.lang.String identifier,
                         java.lang.String modification)
                  throws AccessControlException,
                         AuthorizationException
Store access rights for a given identity. The setter is the user setting the rights, the identifier is the user whose rights are affected. The setter and identifier arguments must be non-null and non-empty. The modification argument must be non-null and follow the syntax of the third argument to a SETACL command. If the modification argument is an empty string, that identifier is removed from the ACL, if currently present.
Parameters:
setter - String representing user attempting to set rights, must be non-null and non-empty
identity - String representing user whose rights are being set, must be non-null and non-empty
modification - String representing the change in rights, following the syntax specified in rfc 2086
Throws:
AccessControlException - if setter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if specified setter does not have the administer right (ie the right to write ACL rights), or if the result of this method would leave no identities with admin rights.

getRights

public java.lang.String getRights(java.lang.String getter,
                                  java.lang.String identity)
                           throws AccessControlException,
                                  AuthorizationException
Retrieve access rights for a specific identity.
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

getAllRights

public java.lang.String getAllRights(java.lang.String getter)
                              throws AccessControlException,
                                     AuthorizationException
Retrieves a String of one or more who have rights in this ACL
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL to this getter.

getRequiredRights

public java.lang.String getRequiredRights(java.lang.String getter,
                                          java.lang.String identity)
                                   throws AccessControlException,
                                          AuthorizationException
Retrieve rights which will always be granted to the specified identity.
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

getOptionalRights

public java.lang.String getOptionalRights(java.lang.String getter,
                                          java.lang.String identity)
                                   throws AccessControlException,
                                          AuthorizationException
Retrieve rights which may be granted to the specified identity.
Parameters:
getter - String representing user attempting to get the rights, must be non-null and non-empty
identity - String representing user whose rights are being got, must be non-null and non-empty
Throws:
AccessControlException - if getter does not have lookup rights for this mailbox (ie they should not know this mailbox exists).
AuthorizationException - if implementation does not wish to expose ACL for this identity to this getter.

hasReadRights

public boolean hasReadRights(java.lang.String username)
                      throws AccessControlException
Helper boolean methods. Provided for cases where you need to check the ACL before selecting the mailbox.
Parameters:
username - String representing user

hasKeepSeenRights

public boolean hasKeepSeenRights(java.lang.String username)
                          throws AccessControlException

hasWriteRights

public boolean hasWriteRights(java.lang.String username)
                       throws AccessControlException

hasInsertRights

public boolean hasInsertRights(java.lang.String username)
                        throws AccessControlException

hasDeleteRights

public boolean hasDeleteRights(java.lang.String username)
                        throws AccessControlException

hasAdminRights

public boolean hasAdminRights(java.lang.String username)
                       throws AccessControlException

getUsersWithLookupRights

public java.util.Set getUsersWithLookupRights()

getUsersWithReadRights

public java.util.Set getUsersWithReadRights()


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.