Package org.apache.ftpserver.usermanager.impl

Examples of org.apache.ftpserver.usermanager.impl.WriteRequest


    /**
     * Check file write permission.
     */
    public boolean isWritable() {
        LOG.debug("Checking authorization for " + getAbsolutePath());
        if (user.authorize(new WriteRequest(getAbsolutePath())) == null) {
            LOG.debug("Not authorized");
            return false;
        }

        LOG.debug("Checking if file exists");
View Full Code Here


         * be deleted when their parent directory is writable.
        */
        String fullName = getAbsolutePath();

        // we check FTPServer's write permission for this file.
        if (user.authorize(new WriteRequest(fullName)) == null) {
            return false;
        }
        // In order to maintain consistency, when possible we delete the last '/' character in the String
        int indexOfSlash = fullName.lastIndexOf('/');
        String parentFullName;
View Full Code Here

        sb.append("userid          : ").append(user.getName()).append("\n");
        sb.append("userpassword    : ********\n");
        sb.append("homedirectory   : ").append(user.getHomeDirectory()).append(
                "\n");
        sb.append("writepermission : ").append(
                user.authorize(new WriteRequest()) != null).append("\n");
        sb.append("enableflag      : ").append(user.getEnabled()).append("\n");
        sb.append("idletime        : ").append(user.getMaxIdleTime()).append(
                "\n");

        TransferRateRequest transferRateRequest = new TransferRateRequest();
View Full Code Here

        return request instanceof WriteRequest;
    }

    public AuthorizationRequest authorize(final AuthorizationRequest request) {
        if ((request instanceof WriteRequest) && this.acm != null) {
            WriteRequest writeRequest = (WriteRequest) request;
            String requestFile = writeRequest.getFile();

            try {
                if (this.acm.hasPrivileges(requestFile, this.write)) {
                    return writeRequest;
                }
View Full Code Here

public class WritePermissionTest extends TestCase {

    public void testRootDir() throws Exception {
        WritePermission permission = new WritePermission("/");

        assertNotNull(permission.authorize(new WriteRequest("/")));
    }
View Full Code Here

    }

    public void testDirs() throws Exception {
        WritePermission permission = new WritePermission("/bar");

        assertNull(permission.authorize(new WriteRequest("/foo")));
        assertNull(permission.authorize(new WriteRequest("/foo/bar")));
        assertNotNull(permission.authorize(new WriteRequest("/bar")));
        assertNotNull(permission.authorize(new WriteRequest("/bar/foo")));
    }
View Full Code Here

        assertEquals(0, getMaxDownloadRate(user));
        assertEquals(0, user.getMaxIdleTime());
        assertEquals(0, getMaxLoginNumber(user));
        assertEquals(0, getMaxLoginPerIP(user));
        assertEquals(0, getMaxUploadRate(user));
        assertNull(user.authorize(new WriteRequest()));
        assertTrue(user.getEnabled());
    }
View Full Code Here

        assertEquals(1, getMaxDownloadRate(user));
        assertEquals(2, user.getMaxIdleTime());
        assertEquals(3, getMaxLoginNumber(user));
        assertEquals(4, getMaxLoginPerIP(user));
        assertEquals(5, getMaxUploadRate(user));
        assertNotNull(user.authorize(new WriteRequest()));
        assertFalse(user.getEnabled());
    }
View Full Code Here

        assertEquals(user.getName(), actualUser.getName());
        assertNull(actualUser.getPassword());
        assertEquals(user.getHomeDirectory(), actualUser.getHomeDirectory());
        assertEquals(user.getEnabled(), actualUser.getEnabled());
        assertNotNull(user.authorize(new WriteRequest()));
        assertEquals(getMaxDownloadRate(user), getMaxDownloadRate(actualUser));
        assertEquals(user.getMaxIdleTime(), actualUser.getMaxIdleTime());
        assertEquals(getMaxLoginNumber(user), getMaxLoginNumber(actualUser));
        assertEquals(getMaxLoginPerIP(user), getMaxLoginPerIP(actualUser));
        assertEquals(getMaxUploadRate(user), getMaxUploadRate(actualUser));
View Full Code Here

        assertEquals(user.getName(), actualUser.getName());
        assertNull(actualUser.getPassword());
        assertEquals(user.getHomeDirectory(), actualUser.getHomeDirectory());
        assertEquals(user.getEnabled(), actualUser.getEnabled());
        assertNotNull(user.authorize(new WriteRequest()));
        assertEquals(getMaxDownloadRate(user), getMaxDownloadRate(actualUser));
        assertEquals(user.getMaxIdleTime(), actualUser.getMaxIdleTime());
        assertEquals(getMaxLoginNumber(user), getMaxLoginNumber(actualUser));
        assertEquals(getMaxLoginPerIP(user), getMaxLoginPerIP(actualUser));
        assertEquals(getMaxUploadRate(user), getMaxUploadRate(actualUser));
View Full Code Here

TOP

Related Classes of org.apache.ftpserver.usermanager.impl.WriteRequest

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.