Package org.jets3t.service.acl

Examples of org.jets3t.service.acl.GrantAndPermission


            assertEquals("Target bucket", bucketName, loggingStatus.getTargetBucketName());
            assertEquals("Log file prefix", "access-log-", loggingStatus.getLogfilePrefix());

            // Add TargetGrants ACLs for log files (S3 only)
            if (!(service instanceof GoogleStorageService)) {
                ((S3BucketLoggingStatus)newLoggingStatus).addTargetGrant(new GrantAndPermission(
                    GroupGrantee.ALL_USERS, Permission.PERMISSION_READ));
                ((S3BucketLoggingStatus)newLoggingStatus).addTargetGrant(new GrantAndPermission(
                    GroupGrantee.AUTHENTICATED_USERS, Permission.PERMISSION_READ_ACP));
                ((S3Service)service)
                    .setBucketLoggingStatus(bucket.getName(), (S3BucketLoggingStatus)newLoggingStatus, true);
                loggingStatus = ((S3Service)service)
                    .getBucketLoggingStatus(bucket.getName());
                assertEquals(2, ((S3BucketLoggingStatus)loggingStatus).getTargetGrants().length);
                GrantAndPermission gap = ((S3BucketLoggingStatus)loggingStatus).getTargetGrants()[0];
                assertEquals(gap.getGrantee().getIdentifier(), GroupGrantee.ALL_USERS.getIdentifier());
                assertEquals(gap.getPermission(), Permission.PERMISSION_READ);
                gap = ((S3BucketLoggingStatus)loggingStatus).getTargetGrants()[1];
                assertEquals(gap.getGrantee().getIdentifier(), GroupGrantee.AUTHENTICATED_USERS.getIdentifier());
                assertEquals(gap.getPermission(), Permission.PERMISSION_READ_ACP);
            }

            // Disable logging
            newLoggingStatus = getBucketLoggingStatus(null, null);
            if (service instanceof GoogleStorageService) {
View Full Code Here


                .elem("TargetPrefix").text(getLogfilePrefix()).up();
            if (targetGrantsList.size() > 0) {
                Iterator<GrantAndPermission> targetGrantsIter = targetGrantsList.iterator();
                XMLBuilder grantsBuilder = enabledBuilder.elem("TargetGrants");
                while (targetGrantsIter.hasNext()) {
                    GrantAndPermission gap = targetGrantsIter.next();
                    grantsBuilder.elem("Grant")
                        .importXMLBuilder(gap.getGrantee().toXMLBuilder())
                        .elem("Permission").text(gap.getPermission().toString());
                }
            }
        }
        return builder;
    }
View Full Code Here

        Set<GrantAndPermission> grants = new HashSet<GrantAndPermission>(Arrays.asList(acl.getGrantAndPermissions()));
        assertEquals(grants.size(), 3);
        Set<GrantAndPermission> grantSet = new HashSet<GrantAndPermission>();
        for (int i = 1; i <= 3; ++i) {
            grantSet.add(new GrantAndPermission(new CanonicalGrantee(Integer.toString(i)), Permission.PERMISSION_READ));
        }
    }
View Full Code Here

TOP

Related Classes of org.jets3t.service.acl.GrantAndPermission

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.