Examples of GSAccessControlList


Examples of org.jets3t.service.acl.gs.GSAccessControlList

  //FIXME: not finished
  public boolean setAcl(String cid, String id, String permission, String clientId) throws StorageCloudException {

    try {
      GSAccessControlList acl = new GSAccessControlList();
      if(permission.equals("rw"))
        acl.grantPermission(new UserByIdGrantee(clientId), Permission.PERMISSION_FULL_CONTROL);
      else if(permission.equals("r"))
        acl.grantPermission(new UserByIdGrantee(clientId), Permission.PERMISSION_READ);
      else if(permission.equals("w"))
        acl.grantPermission(new UserByIdGrantee(clientId), Permission.PERMISSION_WRITE);
      gsService.putBucketAcl(cid, acl);
      return true;
    } catch (ServiceException e) {
      throw new StorageCloudException("AWSS3Exception::" + e.getMessage());
    }
View Full Code Here

Examples of org.jets3t.service.acl.gs.GSAccessControlList

        GSBucket publicBucket = new GSBucket(publicBucketName);
        gsService.createBucket(publicBucketName);

        // Retrieve the bucket's ACL and modify it to grant public access,
        // ie READ access to the ALL_USERS group.
        GSAccessControlList bucketAcl = gsService.getBucketAcl(publicBucketName);
        bucketAcl.grantPermission(new AllUsersGrantee(), Permission.PERMISSION_READ);

        // Update the bucket's ACL. Now anyone can view the list of objects in this bucket.
        publicBucket.setAcl(bucketAcl);
        gsService.putBucketAcl(publicBucket);

        // Now let's create an object that is public from scratch. Note that we will use the bucket's
        // public ACL object created above, this works fine. Although it is possible to create an
        // AccessControlList object from scratch, this is more involved as you need to set the
        // ACL's Owner information which is only readily available from an existing ACL.

        // Create a public object in GS. Anyone can download this object.
        GSObject publicObject = new GSObject("publicObject.txt", "This object is public");
        publicObject.setAcl(bucketAcl);
        gsService.putObject(publicBucketName, publicObject);

        // The ALL_USERS Group is particularly useful, but there are also other grantee types
        // that can be used with AccessControlList. Please see Google Storage technical documentation
        // for a fuller discussion of these settings.

        GSAccessControlList acl = new GSAccessControlList();

        // Grant access by email address. Note that this only works email address of GS members.
        acl.grantPermission(new UserByEmailAddressGrantee("someone@somewhere.com"),
            Permission.PERMISSION_FULL_CONTROL);

        // Grant Read access by Goodle ID.
        acl.grantPermission(new UserByIdGrantee("Google member's ID"),
            Permission.PERMISSION_READ);

        // Grant Write access to a group by domain.
        acl.grantPermission(new GroupByDomainGrantee("yourdomain.com"),
            Permission.PERMISSION_WRITE);
    }
View Full Code Here

Examples of org.jets3t.service.acl.gs.GSAccessControlList

        return new GoogleStorageService(credentials);
    }

    @Override
    protected AccessControlList buildAccessControlList() {
        return new GSAccessControlList();
    }
View Full Code Here

Examples of org.jets3t.service.acl.gs.GSAccessControlList

   @Override
   public void startElement(String name, Attributes attrs) {
       if (name.equals("Owner")) {
           owner = new GSOwner();
       } else if (name.equals("Entries")) {
           accessControlList = new GSAccessControlList();
           accessControlList.setOwner(owner);
           insideACL = true;
       } else if (name.equals("Scope")) {
           scopeType = attrs.getValue("type");
           if (scopeType.equals("UserById")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.