Package org.apache.james.imapserver

Examples of org.apache.james.imapserver.AccessControlException


    public boolean hasKeepSeenRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[KEEP_SEEN];
    }
View Full Code Here


    public boolean hasWriteRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[WRITE];
    }
View Full Code Here

    public boolean hasInsertRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[INSERT];
    }
View Full Code Here

    public boolean hasCreateRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[CREATE];
    }
View Full Code Here

    public boolean hasDeleteRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[DELETE];
    }
View Full Code Here

    public boolean hasAdminRights(String username)
        throws AccessControlException {
        boolean[] usersRights = (boolean[]) acl.get(username);
        if (usersRights == null  || (usersRights[LOOKUP] == false)) {
            throw new AccessControlException(DENY_ACCESS);
        }
        return usersRights[ADMIN];
    }
View Full Code Here

            if ( record.isDeleted() ) {
                throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
            } else if ( openMailboxes.contains( absoluteName ) ) {
                mailbox = openMailboxes.getMailbox( absoluteName );
                if ( ! mailbox.hasLookupRights( user ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                openMailboxes.addReference( absoluteName );
                return mailbox;
            } else {
                String owner = record.getUser();
                String key = getPath( absoluteName );
                ObjectInputStream in = null;
                try {
                    // SK:UPDATE
                    in = new ObjectInputStream( new FileInputStream( key + File.separator + FileMailbox.MAILBOX_FILE_NAME ) );
                    mailbox = (FileMailbox) in.readObject();
                    setupLogger( mailbox );
                    mailbox.configure( conf );
                    mailbox.contextualize( context );
                    mailbox.compose( compMgr );
                    mailbox.reinitialize();
                } catch ( Exception e ) {
                    e.printStackTrace();
                    throw new RuntimeException( "Exception caught while reading FileMailbox: " + e );
                } finally {
                    if ( in != null ) {
                        try {
                            in.close();
                        }
                        catch ( Exception ignored ) {
                        }
                    }
                    notifyAll();
                }
                if ( !mailbox.hasLookupRights( user ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                openMailboxes.addMailbox( absoluteName, mailbox );
                return mailbox;
            }
        }
View Full Code Here

                throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
            } else if ( openMailboxes.contains( absoluteName ) ) {
                response = new String();
                mailbox = openMailboxes.getMailbox( absoluteName );
                if ( !mailbox.hasLookupRights( username ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                while ( it.hasNext() ) {
                    String dataItem = (String) it.next();
                    if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
                        response += "MESSAGES " + mailbox.getExists();
                    } else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
                        response += "RECENT " + mailbox.getRecent();
                    } else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
                        response += "UIDNEXT " + mailbox.getNextUID();
                    } else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
                        response += "UIDVALIDITY " + mailbox.getUIDValidity();
                    } else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
                        response += "UNSEEN " + mailbox.getUnseen( username );
                    }
                    if ( it.hasNext() ) {
                        response += " ";
                    }
                }
                return response;
            }
            else {
                if ( !record.hasLookupRights( username ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                response = new String();
                while ( it.hasNext() ) {
                    String dataItem = (String) it.next();
                    if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
View Full Code Here

            if ( record.isDeleted() ) {
                throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
            } else if ( openMailboxes.contains( absoluteName ) ) {
                mailbox = openMailboxes.getMailbox( absoluteName );
                if ( ! mailbox.hasLookupRights( user ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                openMailboxes.addReference( absoluteName );
                return mailbox;
            } else {
                String owner = record.getUser();
                String key = getPath( absoluteName );
                ObjectInputStream in = null;
                try {
                    // SK:UPDATE
                    in = new ObjectInputStream( new FileInputStream( key + File.separator + FileMailbox.MAILBOX_FILE_NAME ) );
                    mailbox = (FileMailbox) in.readObject();
                    setupLogger( mailbox );
                    mailbox.configure( conf );
                    mailbox.contextualize( context );
                    mailbox.compose( compMgr );
                    mailbox.reinitialize();
                } catch ( Exception e ) {
                    e.printStackTrace();
                    throw new RuntimeException( "Exception caught while reading FileMailbox: " + e );
                } finally {
                    if ( in != null ) {
                        try {
                            in.close();
                        }
                        catch ( Exception ignored ) {
                        }
                    }
                    notifyAll();
                }
                if ( !mailbox.hasLookupRights( user ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                openMailboxes.addMailbox( absoluteName, mailbox );
                return mailbox;
            }
        }
View Full Code Here

                throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
            } else if ( openMailboxes.contains( absoluteName ) ) {
                response = new String();
                mailbox = openMailboxes.getMailbox( absoluteName );
                if ( !mailbox.hasLookupRights( username ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                while ( it.hasNext() ) {
                    String dataItem = (String) it.next();
                    if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
                        response += "MESSAGES " + mailbox.getExists();
                    } else if ( dataItem.equalsIgnoreCase( "RECENT" ) ) {
                        response += "RECENT " + mailbox.getRecent();
                    } else if ( dataItem.equalsIgnoreCase( "UIDNEXT" ) ) {
                        response += "UIDNEXT " + mailbox.getNextUID();
                    } else if ( dataItem.equalsIgnoreCase( "UIDVALIDITY" ) ) {
                        response += "UIDVALIDITY " + mailbox.getUIDValidity();
                    } else if ( dataItem.equalsIgnoreCase( "UNSEEN" ) ) {
                        response += "UNSEEN " + mailbox.getUnseen( username );
                    }
                    if ( it.hasNext() ) {
                        response += " ";
                    }
                }
                return response;
            }
            else {
                if ( !record.hasLookupRights( username ) ) {
                    throw new AccessControlException( "No lookup rights." );
                }
                response = new String();
                while ( it.hasNext() ) {
                    String dataItem = (String) it.next();
                    if ( dataItem.equalsIgnoreCase( "MESSAGES" ) ) {
View Full Code Here

TOP

Related Classes of org.apache.james.imapserver.AccessControlException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.