Search in sources :

Example 1 with GrantAndPermission

use of com.obs.services.model.GrantAndPermission in project jeesuite-libs by vakinge.

the class HuaweicloudProvider method isBucketPrivate.

public boolean isBucketPrivate(String bucketName) {
    if (!existsBucket(bucketName)) {
        throw new RuntimeException("bucket[" + bucketName + "]不存在");
    }
    AccessControlList acl = obsClient.getBucketAcl(bucketName);
    Set<GrantAndPermission> grants = acl.getGrants();
    if (grants != null) {
        for (GrantAndPermission grant : grants) {
            if (grant.getGrantee().equals(GroupGrantee.ALL_USERS) && grant.getPermission().equals(Permission.PERMISSION_READ)) {
                return false;
            }
        }
    }
    return true;
}
Also used : AccessControlList(com.obs.services.model.AccessControlList) GrantAndPermission(com.obs.services.model.GrantAndPermission)

Aggregations

AccessControlList (com.obs.services.model.AccessControlList)1 GrantAndPermission (com.obs.services.model.GrantAndPermission)1