use of com.thinkbiganalytics.security.GroupPrincipal in project kylo by Teradata.
the class JcrUserProviderTest method testUserGetGroupPrincipals.
@Test(dependsOnMethods = "testAddUsersMembers")
public void testUserGetGroupPrincipals() {
metadata.read(() -> {
User user1 = this.provider.findUserBySystemName("user1").get();
User user2 = this.provider.findUserBySystemName("user2").get();
User user3 = this.provider.findUserBySystemName("user3").get();
assertThat(user1.getAllGroupPrincipals()).hasSize(1).contains(new GroupPrincipal("groupA"));
assertThat(user2.getAllGroupPrincipals()).hasSize(2).contains(new GroupPrincipal("groupA"), new GroupPrincipal("groupB"));
assertThat(user3.getAllGroupPrincipals()).hasSize(3).contains(new GroupPrincipal("groupA"), new GroupPrincipal("groupC"), new GroupPrincipal("groupD"));
});
}
use of com.thinkbiganalytics.security.GroupPrincipal in project kylo by Teradata.
the class ActiveDirectoryLoginModuleTest method testLoginAdmin.
// @Test
public void testLoginAdmin() throws Exception {
Subject subject = login("dladmin", "Th1nkb1g!");
assertThat(subject.getPrincipals()).contains(new UsernamePrincipal("dladmin"), new GroupPrincipal("Admin"));
}
use of com.thinkbiganalytics.security.GroupPrincipal in project kylo by Teradata.
the class LdapLoginModuleTest method testLoginAdmin.
@Test
public void testLoginAdmin() throws Exception {
Subject subject = login("dladmin", "thinkbig");
assertThat(subject.getPrincipals()).hasSize(2).contains(new UsernamePrincipal("dladmin"), new GroupPrincipal("admin"));
}
use of com.thinkbiganalytics.security.GroupPrincipal in project kylo by Teradata.
the class UserMetadataService method deleteGroup.
@Override
public boolean deleteGroup(@Nonnull final String groupId) {
Optional<GroupPrincipal> principal = metadataAccess.commit(() -> {
accessController.checkPermission(AccessController.SERVICES, UsersGroupsAccessContol.ADMIN_GROUPS);
return userProvider.findGroupByName(groupId).map(group -> {
GroupPrincipal princ = group.getPrincipal();
userProvider.deleteGroup(group);
return princ;
});
});
// privileged service principal to allow access control changes on all service actions.
if (principal.isPresent()) {
return metadataAccess.commit(() -> {
actionsProvider.getAllowedActions(AllowedActions.SERVICES).ifPresent(allowed -> allowed.disableAll(principal.get()));
return true;
}, MetadataAccess.SERVICE);
} else {
return false;
}
}
Aggregations