Tabnine Logo
AccessControlList
Code IndexAdd Tabnine to your IDE (free)

How to use
AccessControlList
in
alluxio.security.authorization

Best Java code snippets using alluxio.security.authorization.AccessControlList (Showing top 20 results out of 315)

origin: Alluxio/alluxio

  acl = new DefaultAccessControlList();
 } else {
  acl = new AccessControlList();
acl.setOwningUser(owner);
acl.setOwningGroup(owningGroup);
 acl.setEntry(aclEntry);
origin: Alluxio/alluxio

/**
 * @return the list of string entries
 */
public List<String> toStringEntries() {
 List<String> entries = new ArrayList<>();
 for (AclEntry entry : getEntries()) {
  entries.add(entry.toCliString());
 }
 return entries;
}
origin: Alluxio/alluxio

/**
 * 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());
}
origin: Alluxio/alluxio

/**
 * Update the mask to be the union of owning group entry, named user entry and named group entry.
 * This method must be called when the aforementioned entries are modified.
 */
public void updateMask() {
 if (hasExtended()) {
  AclActions actions = getOwningGroupActions();
  mExtendedEntries.updateMask(actions);
 }
}
origin: Alluxio/alluxio

 /**
  * Serialize an AccessControlList object.
  * @param accessControlList the ACL object to be serialized
  * @param jsonGenerator json generator
  * @param serializerProvider default serializer
  * @throws IOException
  */
 @Override
 public void serialize(AccessControlList accessControlList, JsonGenerator jsonGenerator,
   SerializerProvider serializerProvider) throws IOException {
  jsonGenerator.writeStartObject();
  jsonGenerator.writeStringField(OWNER_FIELD, accessControlList.getOwningUser());
  jsonGenerator.writeStringField(OWNING_GROUP_FIELD, accessControlList.getOwningGroup());
  jsonGenerator.writeObjectField(STRING_ENTRY_FIELD, accessControlList.toStringEntries());
  jsonGenerator.writeEndObject();
 }
}
origin: Alluxio/alluxio

protected MoreObjects.ToStringHelper toStringHelper() {
 return MoreObjects.toStringHelper(this)
   .add("id", mId)
   .add("name", mName)
   .add("parentId", mParentId)
   .add("creationTimeMs", mCreationTimeMs)
   .add("pinned", mPinned)
   .add("deleted", mDeleted)
   .add("ttl", mTtl)
   .add("ttlAction", mTtlAction)
   .add("directory", mDirectory)
   .add("persistenceState", mPersistenceState)
   .add("lastModificationTimeMs", mLastModificationTimeMs)
   .add("owner", mAcl.getOwningUser())
   .add("group", mAcl.getOwningGroup())
   .add("permission", mAcl.getMode())
   .add("ufsFingerprint", mUfsFingerprint);
}
origin: Alluxio/alluxio

/**
 * @param acl the access control list to convert
 * @return the proto representation of this object
 */
public static PAcl toProto(AccessControlList acl) {
 PAcl.Builder pAcl = PAcl.newBuilder();
 pAcl.setOwner(acl.getOwningUser());
 pAcl.setOwningGroup(acl.getOwningGroup());
 pAcl.setMode(acl.getMode());
 if (acl.hasExtended()) {
  for (AclEntry entry : acl.getExtendedEntries().getEntries()) {
   pAcl.addEntries(toProto(entry));
  }
 }
 pAcl.setIsDefault(false);
 return pAcl.build();
}
origin: Alluxio/alluxio

builder.setOwningUser(acl.getOwningUser());
builder.setOwningGroup(acl.getOwningGroup());
  .setActions(toProto(acl.getOwningUserActions()))
  .build());
builder.addGroupActions(Acl.NamedAclActions.newBuilder()
  .setName(AccessControlList.OWNING_GROUP_KEY)
  .setActions(toProto(acl.getOwningGroupActions()))
  .build());
builder.setOtherActions(toProto(acl.getOtherActions()));
if (acl.getExtendedEntries() != null) {
 builder.addAllUserActions(getNamedUsersProto(acl.getExtendedEntries()));
 builder.addAllGroupActions(getNamedGroupsProto(acl.getExtendedEntries()));
 builder.setMaskActions(toProto(acl.getExtendedEntries().getMask()));
origin: Alluxio/alluxio

 return new AclActions(getOwningUserActions());
if (hasExtended()) {
 AclActions actions = mExtendedEntries.getNamedUser(user);
 if (actions != null) {
if (groups.contains(mOwningGroup)) {
 isGroupKnown = true;
 groupActions.merge(getOwningGroupActions());
if (hasExtended()) {
 for (String group : groups) {
  AclActions actions = mExtendedEntries.getNamedGroup(group);
 if (hasExtended()) {
  groupActions.mask(mExtendedEntries.mMaskActions);
return getOtherActions();
origin: Alluxio/alluxio

/**
 * Tests the constructor contract.
 */
@Test
public void constructor() {
 AccessControlList acl = new AccessControlList();
 Assert.assertEquals("", acl.getOwningUser());
 Assert.assertEquals("", acl.getOwningGroup());
}
origin: Alluxio/alluxio

/**
 * Tests {@link AccessControlList#getMode()}.
 */
@Test
public void getMode() {
 AccessControlList acl = new AccessControlList();
 Assert.assertEquals(0, acl.getMode());
 acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OWNING_USER).setSubject(OWNING_USER)
   .addAction(AclAction.READ).build());
 acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OWNING_GROUP).setSubject(OWNING_GROUP)
   .addAction(AclAction.WRITE).build());
 acl.setEntry(new AclEntry.Builder().setType(AclEntryType.OTHER)
   .addAction(AclAction.EXECUTE).build());
 Assert.assertEquals(new Mode(Mode.Bits.READ, Mode.Bits.WRITE, Mode.Bits.EXECUTE).toShort(),
   acl.getMode());
}
origin: Alluxio/alluxio

/**
 * Tests {@link AccessControlList#setMode(short)}.
 */
@Test
public void setMode() {
 AccessControlList acl = new AccessControlList();
 short mode = new Mode(Mode.Bits.EXECUTE, Mode.Bits.WRITE, Mode.Bits.READ).toShort();
 acl.setMode(mode);
 Assert.assertEquals(mode, acl.getMode());
}
origin: Alluxio/alluxio

@Override
public String getFingerprint(String path) {
 // TODO(yuzhu): include default ACL in the fingerprint
 try {
  UfsStatus status = getStatus(path);
  Pair<AccessControlList, DefaultAccessControlList> aclPair = getAclPair(path);
  if (aclPair == null || aclPair.getFirst() == null || !aclPair.getFirst().hasExtended()) {
   return Fingerprint.create(getUnderFSType(), status).serialize();
  } else {
   return Fingerprint.create(getUnderFSType(), status, aclPair.getFirst()).serialize();
  }
 } catch (Exception e) {
  // In certain scenarios, it is expected that the UFS path does not exist.
  LOG.debug("Failed fingerprint. path: {} error: {}", path, e.toString());
  return Constants.INVALID_UFS_FINGERPRINT;
 }
}
origin: Alluxio/alluxio

protected MutableInode(long id, boolean isDirectory) {
 mCreationTimeMs = System.currentTimeMillis();
 mDeleted = false;
 mDirectory = isDirectory;
 mId = id;
 mTtl = Constants.NO_TTL;
 mTtlAction = TtlAction.DELETE;
 mLastModificationTimeMs = mCreationTimeMs;
 mName = null;
 mParentId = InodeTree.NO_PARENT;
 mPersistenceState = PersistenceState.NOT_PERSISTED;
 mPinned = false;
 mAcl = new AccessControlList();
 mUfsFingerprint = Constants.INVALID_UFS_FINGERPRINT;
}
origin: Alluxio/alluxio

@Override
public void setEntry(AclEntry entry) {
 if (isEmpty() && mAccessAcl != null) {
  mMode = mAccessAcl.mMode;
 }
 super.setEntry(entry);
 setEmpty(false);
}
origin: Alluxio/alluxio

@Override
public String getOwner() {
 return mAcl.getOwningUser();
}
origin: Alluxio/alluxio

@Override
public String getGroup() {
 return mAcl.getOwningGroup();
}
origin: Alluxio/alluxio

@Override
public AclActions getPermission(String user, List<String> groups) {
 return mAcl.getPermission(user, groups);
}
origin: Alluxio/alluxio

/**
 * @param group the group of the inode
 * @return the updated object
 */
public T setGroup(String group) {
 mAcl.setOwningGroup(group);
 if (isDirectory()) {
  getDefaultACL().setOwningGroup(group);
 }
 return getThis();
}
origin: Alluxio/alluxio

/**
 * @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();
}
alluxio.security.authorizationAccessControlList

Javadoc

Access control list for a file or directory. An access control list is conceptually a list of entries, there are different types of entries: 1. owning user entry which specifies permitted actions for the owning user of a file or directory, there is only one owning user entry; 2. named user entry which specifies permitted actions for any user, there is only one named user entry for each user; 3. owning group entry which specifies permitted actions for the owning group of a file or directory, there is only one owning group entry; 4. named group entry which specifies permitted actions for any group, there is only one named group entry for each group; 5. mask entry which specifies the maximum set of permitted actions for users and groups in all the above entries; 6. other entry which specifies permitted actions for users who are neither the owning user nor have a named user entry, and whose belonging groups are neither the owning group nor have a named group entry. Also, the access control list contains owning user and owning group of a file or directory.

Most used methods

  • <init>
    Creates a new instance where owning user and owning group are initialized to empty strings, and no a
  • getEntries
    Returns a list of AclEntry which represent this ACL instance. The mask will only be included if exte
  • getOwningGroup
  • getOwningUser
  • hasExtended
  • setEntry
    Sets an entry into the access control list. If an entry with the same type and subject already exist
  • setOwningGroup
    Sets owning group.
  • setOwningUser
    Sets owning user.
  • getMode
  • getPermission
    Gets the permitted actions for a user. When AccessControlList is not modified after calling getPermi
  • setMode
    Sets permitted actions for owning user, owning group, and other based on the mode. The format of mod
  • toString
  • setMode,
  • toString,
  • toStringEntries,
  • checkPermission,
  • clearEntries,
  • fromStringEntries,
  • getOtherActions,
  • getOwningGroupActions,
  • getOwningUserActions,
  • removeEntry

Popular in Java

  • Making http requests using okhttp
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Menu (java.awt)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top 12 Jupyter Notebook extensions
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