congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AccessControlList.getGrants
Code IndexAdd Tabnine to your IDE (free)

How to use
getGrants
method
in
org.jclouds.s3.domain.AccessControlList

Best Java code snippets using org.jclouds.s3.domain.AccessControlList.getGrants (Showing top 20 results out of 315)

origin: jclouds/legacy-jclouds

/**
* @return an unmodifiable set of grantees who have been assigned permissions in this ACL.
*/
public Set<Grantee> getGrantees() {
 Set<Grantee> grantees = Sets.newTreeSet();
 for (Grant grant : getGrants()) {
   grantees.add(grant.getGrantee());
 }
 return Collections.unmodifiableSet(grantees);
}
origin: org.jclouds.api/s3

/**
* @return an unmodifiable set of grantees who have been assigned permissions in this ACL.
*/
public Set<Grantee> getGrantees() {
 Set<Grantee> grantees = Sets.newTreeSet();
 for (Grant grant : getGrants()) {
   grantees.add(grant.getGrantee());
 }
 return Collections.unmodifiableSet(grantees);
}
origin: Nextdoor/bender

/**
* @return an unmodifiable set of grantees who have been assigned permissions in this ACL.
*/
public Set<Grantee> getGrantees() {
 Set<Grantee> grantees = Sets.newTreeSet();
 for (Grant grant : getGrants()) {
   grantees.add(grant.getGrantee());
 }
 return Collections.unmodifiableSet(grantees);
}
origin: org.apache.jclouds.api/s3

/**
* @return an unmodifiable set of grantees who have been assigned permissions in this ACL.
*/
public Set<Grantee> getGrantees() {
 Set<Grantee> grantees = Sets.newTreeSet();
 for (Grant grant : getGrants()) {
   grantees.add(grant.getGrantee());
 }
 return Collections.unmodifiableSet(grantees);
}
origin: apache/jclouds

/**
* @return an unmodifiable set of grantees who have been assigned permissions in this ACL.
*/
public Set<Grantee> getGrantees() {
 Set<Grantee> grantees = Sets.newTreeSet();
 for (Grant grant : getGrants()) {
   grantees.add(grant.getGrantee());
 }
 return Collections.unmodifiableSet(grantees);
}
origin: jclouds/legacy-jclouds

@Test
public void testAccessControlListOwnerOnly() throws HttpException {
 String ownerId = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
 AccessControlList acl = createParser().parse(Strings2.toInputStream(aclOwnerOnly));
 assertEquals(acl.getOwner().getId(), ownerId);
 assertEquals(acl.getOwner().getDisplayName(), "jamesmurty");
 assertEquals(acl.getPermissions(ownerId).size(), 1);
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 assertEquals(acl.getGrants().size(), 1);
 assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 0);
 assertEquals(acl.getPermissions(GroupGranteeURI.AUTHENTICATED_USERS).size(), 0);
 assertEquals(acl.getPermissions(GroupGranteeURI.LOG_DELIVERY).size(), 0);
}
origin: jclouds/legacy-jclouds

 public void run() {
   try {
    AccessControlList acl = getApi().getObjectACL(containerName, publicReadObjectKey);
    assertEquals(acl.getGrants().size(), 2);
    assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1);
    assertNotNull(acl.getOwner());
    String ownerId = acl.getOwner().getId();
    assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
    assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
   } catch (Exception e) {
    Throwables.propagateIfPossible(e);
   }
 }
});
origin: apache/jclouds

@Test
public void testAccessControlListOwnerOnly() throws HttpException {
 String ownerId = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
 AccessControlList acl = createParser().parse(Strings2.toInputStream(aclOwnerOnly));
 assertEquals(acl.getOwner().getId(), ownerId);
 assertEquals(acl.getOwner().getDisplayName(), "jamesmurty");
 assertEquals(acl.getPermissions(ownerId).size(), 1);
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 assertEquals(acl.getGrants().size(), 1);
 assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 0);
 assertEquals(acl.getPermissions(GroupGranteeURI.AUTHENTICATED_USERS).size(), 0);
 assertEquals(acl.getPermissions(GroupGranteeURI.LOG_DELIVERY).size(), 0);
}
origin: apache/jclouds

 public void run() {
   try {
    AccessControlList acl = getApi().getObjectACL(containerName, publicReadObjectKey);
    assertEquals(acl.getGrants().size(), 2);
    assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 1);
    assertNotNull(acl.getOwner());
    String ownerId = acl.getOwner().getId();
    assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
    assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
   } catch (Exception e) {
    Throwables.propagateIfPossible(e);
   }
 }
});
origin: jclouds/legacy-jclouds

 public void run() {
   try {
    AccessControlList acl = getApi().getObjectACL(containerName, publicReadWriteObjectKey);
    assertEquals(acl.getGrants().size(), 3);
    assertEquals(acl.getPermissions(GroupGranteeURI.ALL_USERS).size(), 2);
    assertNotNull(acl.getOwner());
    String ownerId = acl.getOwner().getId();
    assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
    assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
    assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.WRITE));
    assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ_ACP));
    assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.WRITE_ACP));
    assertFalse(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.FULL_CONTROL));
   } catch (Exception e) {
    Throwables.propagateIfPossible(e);
   }
 }
});
origin: jclouds/legacy-jclouds

private void checkGrants(AccessControlList acl) {
 String ownerId = acl.getOwner().getId();
 assertEquals(acl.getGrants().size(), 4, acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL), acl.toString());
 assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.WRITE_ACP), acl.toString());
 // EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by email addr
 assertTrue(acl.hasPermission(TEST_ACL_ID, Permission.READ_ACP), acl.toString());
}
origin: jclouds/legacy-jclouds

public void testPrivateAclIsDefaultForBucket() throws InterruptedException, ExecutionException, TimeoutException,
   IOException {
 String bucketName = getContainerName();
 try {
   AccessControlList acl = getApi().getBucketACL(bucketName);
   assertEquals(acl.getGrants().size(), 1);
   assertNotNull(acl.getOwner());
   String ownerId = acl.getOwner().getId();
   assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 } finally {
   returnContainer(bucketName);
 }
}
origin: jclouds/legacy-jclouds

private void checkGrants(AccessControlList acl) {
 String ownerId = acl.getOwner().getId();
 assertEquals(acl.getGrants().size(), 4, acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL), acl.toString());
 assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.WRITE_ACP), acl.toString());
 // EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by email addr
 assertTrue(acl.hasPermission(StubS3AsyncClient.TEST_ACL_ID, Permission.READ_ACP), acl.toString());
}
origin: apache/jclouds

@Test
public void testAccessControlListExtreme() throws HttpException {
 String ownerId = "1a405254c932b52e5b5caaa88186bc431a1bacb9ece631f835daddaf0c47677c";
 AccessControlList acl = createParser().parse(Strings2.toInputStream(aclExtreme));
 assertEquals(acl.getOwner().getId(), ownerId);
 assertEquals(acl.getOwner().getDisplayName(), "jamesmurty");
 assertEquals(acl.getPermissions(ownerId).size(), 3);
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 assertTrue(acl.hasPermission(ownerId, Permission.READ));
 assertTrue(acl.hasPermission(ownerId, Permission.WRITE));
 assertEquals(acl.getGrants().size(), 9);
 assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ));
 assertTrue(acl.hasPermission(GroupGranteeURI.AUTHENTICATED_USERS, Permission.READ));
 assertTrue(acl.hasPermission(GroupGranteeURI.AUTHENTICATED_USERS, Permission.WRITE));
 assertTrue(acl.hasPermission(GroupGranteeURI.AUTHENTICATED_USERS, Permission.READ_ACP));
 assertTrue(acl.hasPermission(GroupGranteeURI.AUTHENTICATED_USERS, Permission.WRITE_ACP));
 assertTrue(acl.hasPermission(GroupGranteeURI.LOG_DELIVERY, Permission.WRITE));
}
origin: apache/jclouds

public void testPrivateAclIsDefaultForBucket() throws InterruptedException, ExecutionException, TimeoutException,
   IOException {
 String bucketName = getContainerName();
 try {
   AccessControlList acl = getApi().getBucketACL(bucketName);
   assertEquals(acl.getGrants().size(), 1);
   assertNotNull(acl.getOwner());
   String ownerId = acl.getOwner().getId();
   assertTrue(acl.hasPermission(ownerId, FULL_CONTROL));
 } finally {
   returnContainer(bucketName);
 }
}
origin: apache/jclouds

private void checkGrants(AccessControlList acl) {
 String ownerId = acl.getOwner().getId();
 assertEquals(acl.getGrants().size(), 4, acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL), acl.toString());
 assertTrue(acl.hasPermission(GroupGranteeURI.ALL_USERS, Permission.READ), acl.toString());
 assertTrue(acl.hasPermission(ownerId, Permission.WRITE_ACP), acl.toString());
 // EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by email addr
 assertTrue(acl.hasPermission(TEST_ACL_ID, Permission.READ_ACP), acl.toString());
}
origin: apache/jclouds

private void checkGrants(AccessControlList acl) {
 String ownerId = acl.getOwner().getId();
 assertEquals(acl.getGrants().size(), 4, acl.toString());
 assertTrue(acl.hasPermission(ownerId, FULL_CONTROL), acl.toString());
 assertTrue(acl.hasPermission(ALL_USERS, READ), acl.toString());
 assertTrue(acl.hasPermission(ownerId, WRITE_ACP), acl.toString());
 // EmailAddressGrantee is replaced by a CanonicalUserGrantee, so we cannot test by email addr
 assertTrue(acl.hasPermission(TEST_ACL_ID, READ_ACP), acl.toString());
}
origin: jclouds/legacy-jclouds

public void testUpdateBucketACL() throws InterruptedException, ExecutionException, TimeoutException, IOException,
   Exception {
 String bucketName = getContainerName();
 try {
   // Confirm the bucket is private
   AccessControlList acl = getApi().getBucketACL(bucketName);
   String ownerId = acl.getOwner().getId();
   assertEquals(acl.getGrants().size(), 1);
   assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
   addGrantsToACL(acl);
   assertEquals(acl.getGrants().size(), 4);
   assertTrue(getApi().putBucketACL(bucketName, acl));
   // Confirm that the updated ACL has stuck.
   acl = getApi().getBucketACL(bucketName);
   checkGrants(acl);
 } finally {
   destroyContainer(bucketName);
 }
}
origin: jclouds/legacy-jclouds

public void testPrivateAclIsDefaultForObject() throws InterruptedException, ExecutionException, TimeoutException,
    IOException {
 String privateObjectKey = "private-acl";
 String containerName = getContainerName();
 try {
   // Private object
   addBlobToContainer(containerName, privateObjectKey);
   AccessControlList acl = getApi().getObjectACL(containerName, privateObjectKey);
   assertEquals(acl.getGrants().size(), 1);
   assertNotNull(acl.getOwner());
   String ownerId = acl.getOwner().getId();
   assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 } finally {
   returnContainer(containerName);
 }
}
origin: apache/jclouds

public void testPrivateAclIsDefaultForObject() throws InterruptedException, ExecutionException, TimeoutException,
    IOException {
 String privateObjectKey = "private-acl";
 String containerName = getContainerName();
 try {
   // Private object
   addBlobToContainer(containerName, privateObjectKey);
   AccessControlList acl = getApi().getObjectACL(containerName, privateObjectKey);
   assertEquals(acl.getGrants().size(), 1);
   assertNotNull(acl.getOwner());
   String ownerId = acl.getOwner().getId();
   assertTrue(acl.hasPermission(ownerId, Permission.FULL_CONTROL));
 } finally {
   returnContainer(containerName);
 }
}
org.jclouds.s3.domainAccessControlListgetGrants

Popular methods of AccessControlList

  • hasPermission
  • <init>
  • addPermission
    Add a permission for the given grantee.
  • getOwner
  • getPermissions
  • toString
  • findGrantsForGrantee
    Find all the grants for a given grantee, identified by an ID which allows all Grantee types to be se
  • revokePermission
    Revoke a permission for the given grantee, if this specific permission was granted. Note that you mu
  • setOwner
  • fromCannedAccessPolicy
    Converts a canned access control policy into the equivalent access control list.
  • revokeAllPermissions
    Revoke all the permissions granted to the given grantee.
  • revokeAllPermissions

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • TreeMap (java.util)
    Walk the nodes of the tree left-to-right or right-to-left. Note that in descending iterations, next
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now