@Test public void testNetgroups() throws Exception { if(!NativeCodeLoader.isNativeCodeLoaded()) { LOG.info("Not testing netgroups, " + "this test only runs when native code is compiled"); return; } String groupMappingClassName = System.getProperty("TestAccessControlListGroupMapping"); if(groupMappingClassName == null) { LOG.info("Not testing netgroups, no group mapping class specified, " + "use -DTestAccessControlListGroupMapping=$className to specify " + "group mapping class (must implement GroupMappingServiceProvider " + "interface and support netgroups)"); return; } LOG.info("Testing netgroups using: " + groupMappingClassName); Configuration conf = new Configuration(); conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_GROUP_MAPPING, groupMappingClassName); Groups groups = Groups.getUserToGroupsMappingService(conf); AccessControlList acl; acl = new AccessControlList("ja my"); acl = new AccessControlList("sinatra ratpack,@lasVegas"); acl = new AccessControlList(" somegroup,@someNetgroup"); acl = new AccessControlList("carlPerkins ratpack,@lasVegas"); acl.addGroup("@memphis"); validateNetgroups(groups, acl); groups.refresh(); validateNetgroups(groups, acl); }
public void addGroup(String group) { if (isWildCardACLValue(group)) { throw new IllegalArgumentException("Group " + group + " can not be added"); } if (!isAllAllowed()) { List<String> groupsList = new LinkedList<String>(); groupsList.add(group); groupsMapping.cacheGroupsAdd(groupsList); groups.add(group); } }
AccessControlList implements Writable { public void addGroup(String group) { if (isWildCardACLValue(group)) { throw new IllegalArgumentException("Group " + group + " can not be added"); } if (!isAllAllowed()) { List<String> groupsList = new LinkedList<String>(); groupsList.add(group); groupsMapping.cacheGroupsAdd(groupsList); groups.add(group); } } }
AccessControlList implements Writable { public void addGroup(String group) { if (isWildCardACLValue(group)) { throw new IllegalArgumentException("Group " + group + " can not be added"); } if (!isAllAllowed()) { List<String> groupsList = new LinkedList<String>(); groupsList.add(group); groupsMapping.cacheGroupsAdd(groupsList); groups.add(group); } } AccessControlList();  AccessControlList(String aclString);  AccessControlList(String users, String groups); }
AccessControlList implements Writable { public void addGroup(String group) { if (isWildCardACLValue(group)) { throw new IllegalArgumentException("Group " + group + " can not be added"); } if (!isAllAllowed()) { List<String> groupsList = new LinkedList<String>(); groupsList.add(group); groupsMapping.cacheGroupsAdd(groupsList); groups.add(group); } } AccessControlList();  AccessControlList(String aclString);  AccessControlList(String users, String groups); boolean isAllAllowed(); void addUser(String user); void addGroup(String group); void removeUser(String user); void removeGroup(String group); boolean isUserAllowed(UserGroupInformation ugi); @Override String toString(); String getAclString(); @Override void write(DataOutput out); @Override void readFields(DataInput in); }
AccessControlList implements Writable { public void addGroup(String group) { if (isWildCardACLValue(group)) { throw new IllegalArgumentException("Group " + group + " can not be added"); } if (!isAllAllowed()) { List<String> groupsList = new LinkedList<String>(); groupsList.add(group); groupsMapping.cacheGroupsAdd(groupsList); groups.add(group); } } AccessControlList();  AccessControlList(String aclString);  AccessControlList(String users, String groups); boolean isAllAllowed(); void addUser(String user); void addGroup(String group); void removeUser(String user); void removeGroup(String group); boolean isUserAllowed(UserGroupInformation ugi); @Override String toString(); String getAclString(); @Override void write(DataOutput out); @Override void readFields(DataInput in); static final String WILDCARD_ACL_VALUE; }