use of com.thinkbiganalytics.metadata.api.user.UserGroup in project kylo by Teradata.
the class GroupNamesUpgradeAction method upgradeTo.
/* (non-Javadoc)
* @see com.thinkbiganalytics.metadata.upgrade.UpgradeState#upgradeFrom(com.thinkbiganalytics.metadata.api.app.KyloVersion)
*/
@Override
public void upgradeTo(KyloVersion startingVersion) {
log.info("Upgrading from version: " + startingVersion);
this.userProvider.findGroupByName("designer").ifPresent(oldGrp -> {
UserGroup designersGroup = createDefaultGroup("designers", "Designers");
oldGrp.getUsers().forEach(user -> designersGroup.addUser(user));
actionsProvider.getAllowedActions(AllowedActions.SERVICES).ifPresent((allowed) -> {
allowed.enable(designersGroup.getRootPrincial(), OperationsAccessControl.ACCESS_OPS, FeedServicesAccessControl.EDIT_FEEDS, FeedServicesAccessControl.ACCESS_TABLES, FeedServicesAccessControl.IMPORT_FEEDS, FeedServicesAccessControl.EXPORT_FEEDS, FeedServicesAccessControl.EDIT_CATEGORIES, FeedServicesAccessControl.EDIT_DATASOURCES, FeedServicesAccessControl.EDIT_TEMPLATES, FeedServicesAccessControl.IMPORT_TEMPLATES, FeedServicesAccessControl.EXPORT_TEMPLATES, FeedServicesAccessControl.ADMIN_TEMPLATES, FeedServicesAccessControl.ACCESS_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.ACCESS_GLOBAL_SEARCH);
});
this.userProvider.deleteGroup(oldGrp);
});
this.userProvider.findGroupByName("analyst").ifPresent(oldGrp -> {
UserGroup analystsGroup = createDefaultGroup("analysts", "Analysts");
oldGrp.getUsers().forEach(user -> analystsGroup.addUser(user));
actionsProvider.getAllowedActions(AllowedActions.SERVICES).ifPresent((allowed) -> {
allowed.enable(analystsGroup.getRootPrincial(), OperationsAccessControl.ACCESS_OPS, FeedServicesAccessControl.EDIT_FEEDS, FeedServicesAccessControl.ACCESS_TABLES, FeedServicesAccessControl.IMPORT_FEEDS, FeedServicesAccessControl.EXPORT_FEEDS, FeedServicesAccessControl.EDIT_CATEGORIES, FeedServicesAccessControl.ACCESS_TEMPLATES, FeedServicesAccessControl.ACCESS_DATASOURCES, FeedServicesAccessControl.ACCESS_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.ACCESS_GLOBAL_SEARCH);
});
this.userProvider.deleteGroup(oldGrp);
});
}
use of com.thinkbiganalytics.metadata.api.user.UserGroup in project kylo by Teradata.
the class GroupNamesUpgradeAction method upgradeTo.
/* (non-Javadoc)
* @see com.thinkbiganalytics.metadata.upgrade.UpgradeState#upgradeFrom(com.thinkbiganalytics.metadata.api.app.KyloVersion)
*/
@Override
public void upgradeTo(KyloVersion startingVersion) {
log.info("Upgrading from version: " + startingVersion);
this.userProvider.findGroupByName("designer").ifPresent(oldGrp -> {
UserGroup designersGroup = createDefaultGroup("designers", "Designers");
oldGrp.getUsers().forEach(user -> designersGroup.addUser(user));
actionsProvider.getAllowedActions(AllowedActions.SERVICES).ifPresent((allowed) -> {
allowed.enable(designersGroup.getRootPrincial(), OperationsAccessControl.ACCESS_OPS, FeedServicesAccessControl.EDIT_FEEDS, FeedServicesAccessControl.ACCESS_TABLES, FeedServicesAccessControl.IMPORT_FEEDS, FeedServicesAccessControl.EXPORT_FEEDS, FeedServicesAccessControl.EDIT_CATEGORIES, FeedServicesAccessControl.EDIT_DATASOURCES, FeedServicesAccessControl.EDIT_TEMPLATES, FeedServicesAccessControl.IMPORT_TEMPLATES, FeedServicesAccessControl.EXPORT_TEMPLATES, FeedServicesAccessControl.ADMIN_TEMPLATES, FeedServicesAccessControl.ACCESS_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.ACCESS_GLOBAL_SEARCH);
});
this.userProvider.deleteGroup(oldGrp);
});
this.userProvider.findGroupByName("analyst").ifPresent(oldGrp -> {
UserGroup analystsGroup = createDefaultGroup("analysts", "Analysts");
oldGrp.getUsers().forEach(user -> analystsGroup.addUser(user));
actionsProvider.getAllowedActions(AllowedActions.SERVICES).ifPresent((allowed) -> {
allowed.enable(analystsGroup.getRootPrincial(), OperationsAccessControl.ACCESS_OPS, FeedServicesAccessControl.EDIT_FEEDS, FeedServicesAccessControl.ACCESS_TABLES, FeedServicesAccessControl.IMPORT_FEEDS, FeedServicesAccessControl.EXPORT_FEEDS, FeedServicesAccessControl.EDIT_CATEGORIES, FeedServicesAccessControl.ACCESS_TEMPLATES, FeedServicesAccessControl.ACCESS_DATASOURCES, FeedServicesAccessControl.ACCESS_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.EDIT_SERVICE_LEVEL_AGREEMENTS, FeedServicesAccessControl.ACCESS_GLOBAL_SEARCH);
});
this.userProvider.deleteGroup(oldGrp);
});
}
use of com.thinkbiganalytics.metadata.api.user.UserGroup in project kylo by Teradata.
the class GroupNamesUpgradeAction method createDefaultGroup.
protected UserGroup createDefaultGroup(String groupName, String title) {
UserGroup newGroup = userProvider.ensureGroup(groupName);
newGroup.setTitle(title);
return newGroup;
}
use of com.thinkbiganalytics.metadata.api.user.UserGroup in project kylo by Teradata.
the class JcrUserProviderTest method testFindGroupByName.
@Test(dependsOnMethods = "testCreateGroup")
public void testFindGroupByName() {
metadata.read(() -> {
Optional<UserGroup> optional = provider.findGroupByName("groupA");
assertThat(optional.isPresent()).isTrue();
UserGroup groupA = optional.get();
assertThat(groupA).extracting(UserGroup::getSystemName).containsExactly("groupA");
}, MetadataAccess.SERVICE);
}
use of com.thinkbiganalytics.metadata.api.user.UserGroup in project kylo by Teradata.
the class JcrUserProviderTest method testAddUsersMembers.
@Test(dependsOnMethods = "testCreateMemberGroups")
public void testAddUsersMembers() {
metadata.commit(() -> {
User user1 = this.provider.findUserBySystemName("user1").get();
User user2 = this.provider.findUserBySystemName("user2").get();
User user3 = this.provider.findUserBySystemName("user3").get();
UserGroup groupA = this.provider.findGroupByName("groupA").get();
UserGroup groupB = this.provider.findGroupByName("groupB").get();
UserGroup groupD = this.provider.findGroupByName("groupD").get();
assertThat(groupA.addUser(user1)).isTrue();
assertThat(groupB.addUser(user2)).isTrue();
assertThat(groupD.addUser(user3)).isTrue();
}, MetadataAccess.SERVICE);
}
Aggregations