/** * @param owner the owner name of the inode * @return the updated object */ public T setOwner(String owner) { mAcl.setOwningUser(owner); if (isDirectory()) { getDefaultACL().setOwningUser(owner); } return getThis(); }
acl.setOwningUser(owner); acl.setOwningGroup(owningGroup);
/** * Tests getting and setting owner and group. */ @Test public void ownerGroup() { AccessControlList acl = new AccessControlList(); acl.setOwningUser(OWNING_USER); acl.setOwningGroup(OWNING_GROUP); Assert.assertEquals(OWNING_USER, acl.getOwningUser()); Assert.assertEquals(OWNING_GROUP, acl.getOwningGroup()); }
/** * @param pAcl the proto representation * @return the {@link AccessControlList} instance created from the proto representation */ public static AccessControlList fromProto(PAcl pAcl) { AccessControlList acl; if (pAcl.getIsDefault()) { acl = new DefaultAccessControlList(); ((DefaultAccessControlList) acl).setEmpty(pAcl.getIsDefaultEmpty()); } else { acl = new AccessControlList(); } acl.setOwningUser(pAcl.getOwner()); acl.setOwningGroup(pAcl.getOwningGroup()); acl.setMode((short) pAcl.getMode()); if (pAcl.getEntriesCount() > 0) { for (PAclEntry tEntry : pAcl.getEntriesList()) { acl.setEntry(fromProto(tEntry)); } } return acl; }
acl.setOwningUser(OWNING_USER); acl.setOwningGroup(OWNING_GROUP); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OWNING_USER).setSubject(OWNING_USER)
ret = new AccessControlList(); ret.setOwningUser(acl.getOwningUser()); ret.setOwningGroup(acl.getOwningGroup());
acl.setOwningUser(entry.getOwner()); acl.setOwningGroup(entry.getGroup()); short mode = entry.hasMode() ? (short) entry.getMode() : Constants.DEFAULT_FILE_SYSTEM_MODE;
acl.setOwningUser(entry.getOwner()); acl.setOwningGroup(entry.getGroup()); short mode = entry.hasMode() ? (short) entry.getMode() : Constants.DEFAULT_FILE_SYSTEM_MODE;
private void setPermissions(AccessControlList acl) { // owning user: rwx // owning group: r-x // other: --x // named user: r-x // named group: r-- // named group 2: -wx acl.setOwningUser(OWNING_USER); acl.setOwningGroup(OWNING_GROUP); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OWNING_USER).setSubject(OWNING_USER) .addAction(AclAction.READ).addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build()); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OWNING_GROUP).setSubject(OWNING_GROUP) .addAction(AclAction.READ).addAction(AclAction.EXECUTE).build()); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OTHER) .addAction(AclAction.EXECUTE).build()); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.NAMED_USER).setSubject(NAMED_USER) .addAction(AclAction.READ).addAction(AclAction.EXECUTE).build()); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.NAMED_GROUP).setSubject(NAMED_GROUP) .addAction(AclAction.READ).build()); acl.setEntry(new AclEntry.Builder().setType(AclEntryType.NAMED_GROUP).setSubject(NAMED_GROUP2) .addAction(AclAction.WRITE).addAction(AclAction.EXECUTE).build()); acl.updateMask(); }