alluxio.security.authorization.Mode.getGroupBits()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中alluxio.security.authorization.Mode.getGroupBits()方法的一些代码示例,展示了Mode.getGroupBits()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mode.getGroupBits()方法的具体详情如下:
包路径:alluxio.security.authorization.Mode
类名称:Mode
方法名:getGroupBits

Mode.getGroupBits介绍

暂无

代码示例

代码示例来源:origin: Alluxio/alluxio

@Test
public void setGroupBits() {
 Mode mode = new Mode((short) 0000);
 mode.setGroupBits(Mode.Bits.READ_EXECUTE);
 assertEquals(Mode.Bits.READ_EXECUTE, mode.getGroupBits());
 mode.setGroupBits(Mode.Bits.WRITE);
 assertEquals(Mode.Bits.WRITE, mode.getGroupBits());
 mode.setGroupBits(Mode.Bits.ALL);
 assertEquals(Mode.Bits.ALL, mode.getGroupBits());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Applies the given umask {@link Mode} to this mode.
 *
 * @param mode the mode to update
 * @param umask the umask to apply
 * @return the updated object
 */
private static Mode applyUMask(Mode mode, Mode umask) {
 mode.setOwnerBits(mode.getOwnerBits().and(umask.getOwnerBits().not()));
 mode.setGroupBits(mode.getGroupBits().and(umask.getGroupBits().not()));
 mode.setOtherBits(mode.getOtherBits().and(umask.getOtherBits().not()));
 return mode;
}

代码示例来源:origin: Alluxio/alluxio

@Test
public void symbolicsSeparated() {
 Mode parsed = ModeParser.parse("u=rwx,g=rwx,o=rwx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOtherBits());
 parsed = ModeParser.parse("u=rwx,g=rx,o=rx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getOtherBits());
 parsed = ModeParser.parse("u=rw,g=r,o=r");
 Assert.assertEquals(Mode.Bits.READ_WRITE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

@Test
public void symbolicsPartial() {
 Mode parsed = ModeParser.parse("u=rwx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOtherBits());
 parsed = ModeParser.parse("go=rw");
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ_WRITE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ_WRITE, parsed.getOtherBits());
 parsed = ModeParser.parse("o=x");
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.EXECUTE, parsed.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

@Test
public void numerics() {
 Mode parsed = ModeParser.parse("777");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOtherBits());
 parsed = ModeParser.parse("755");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getOtherBits());
 parsed = ModeParser.parse("644");
 Assert.assertEquals(Mode.Bits.READ_WRITE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

@Test
public void symbolicsCumulative() {
 Mode parsed = ModeParser.parse("u=r,u=w,u=x");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOtherBits());
 parsed = ModeParser.parse("g=r,g=w,g=x");
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOtherBits());
 parsed = ModeParser.parse("o=r,o=w,o=x");
 Assert.assertEquals(Mode.Bits.NONE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.NONE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

@Test
public void symbolicsCombined() {
 Mode parsed = ModeParser.parse("a=rwx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOtherBits());
 parsed = ModeParser.parse("ugo=rwx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOtherBits());
 parsed = ModeParser.parse("u=rwx,go=rx");
 Assert.assertEquals(Mode.Bits.ALL, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ_EXECUTE, parsed.getOtherBits());
 parsed = ModeParser.parse("u=rw,go=r");
 Assert.assertEquals(Mode.Bits.READ_WRITE, parsed.getOwnerBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getGroupBits());
 Assert.assertEquals(Mode.Bits.READ, parsed.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests the {@link Mode#fromShort(short)} method.
 */
@Test
public void fromShort() {
 Mode mode = new Mode((short) 0777);
 assertEquals(Mode.Bits.ALL, mode.getOwnerBits());
 assertEquals(Mode.Bits.ALL, mode.getGroupBits());
 assertEquals(Mode.Bits.ALL, mode.getOtherBits());
 mode = new Mode((short) 0644);
 assertEquals(Mode.Bits.READ_WRITE, mode.getOwnerBits());
 assertEquals(Mode.Bits.READ, mode.getGroupBits());
 assertEquals(Mode.Bits.READ, mode.getOtherBits());
 mode = new Mode((short) 0755);
 assertEquals(Mode.Bits.ALL, mode.getOwnerBits());
 assertEquals(Mode.Bits.READ_EXECUTE, mode.getGroupBits());
 assertEquals(Mode.Bits.READ_EXECUTE, mode.getOtherBits());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests the {@link Mode#createNoAccess()} method.
 */
@Test
public void createNoAccess() {
 Mode mode = Mode.createNoAccess();
 assertEquals(Mode.Bits.NONE, mode.getOwnerBits());
 assertEquals(Mode.Bits.NONE, mode.getGroupBits());
 assertEquals(Mode.Bits.NONE, mode.getOtherBits());
 assertEquals(0000, mode.toShort());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests the {@link Mode#Mode(Mode)} constructor.
 */
@Test
public void copyConstructor() {
 Mode mode = new Mode(Mode.defaults());
 assertEquals(Mode.Bits.ALL, mode.getOwnerBits());
 assertEquals(Mode.Bits.ALL, mode.getGroupBits());
 assertEquals(Mode.Bits.ALL, mode.getOtherBits());
 assertEquals(0777, mode.toShort());
}

代码示例来源:origin: Alluxio/alluxio

/**
 * Tests the {@link Mode#getUMask()} and
 * {@link Mode#applyUMask(Mode)} methods.
 */
@Test
public void umask() {
 String umask = "0022";
 Mode mode = ModeUtils.applyDirectoryUMask(Mode.defaults(), umask);
 assertEquals(Mode.Bits.ALL, mode.getOwnerBits());
 assertEquals(Mode.Bits.READ_EXECUTE, mode.getGroupBits());
 assertEquals(Mode.Bits.READ_EXECUTE, mode.getOtherBits());
 assertEquals(0755, mode.toShort());
}

代码示例来源:origin: Alluxio/alluxio

if (mAccessAcl != null) {
 modeGroup.setGroupBits(new Mode(mAccessAcl.mMode).getGroupBits());

代码示例来源:origin: Alluxio/alluxio

groupAction.updateByModeBits(defaultMode.getGroupBits());
mask.mask(groupAction);

代码示例来源:origin: Alluxio/alluxio

@Test
public void getPermission() throws Exception {
 try (LockedInodePath path =
      sTree.lockInodePath(new AlluxioURI(TEST_WEIRD_FILE_URI), LockPattern.READ)) {
  // user is admin
  AuthenticatedClientUser.set(TEST_USER_ADMIN.getUser());
  Mode.Bits perm = mPermissionChecker.getPermission(path);
  Assert.assertEquals(Mode.Bits.ALL, perm);
  // user is owner
  AuthenticatedClientUser.set(TEST_USER_1.getUser());
  perm = mPermissionChecker.getPermission(path);
  Assert.assertEquals(TEST_WEIRD_MODE.getOwnerBits(), perm);
  // user is not owner but in group
  AuthenticatedClientUser.set(TEST_USER_3.getUser());
  perm = mPermissionChecker.getPermission(path);
  Assert.assertEquals(TEST_WEIRD_MODE.getGroupBits(), perm);
  // user is other
  AuthenticatedClientUser.set(TEST_USER_2.getUser());
  perm = mPermissionChecker.getPermission(path);
  Assert.assertEquals(TEST_WEIRD_MODE.getOtherBits(), perm);
 }
}

相关文章