use of com.epam.pipeline.controller.vo.PermissionGrantVO in project cloud-pipeline by epam.
the class FolderTemplateManager method createFolderFromTemplate.
void createFolderFromTemplate(Folder folder, FolderTemplate template) {
folder.setName(template.getName());
Folder savedFolder = crudManager.create(folder);
if (CollectionUtils.isNotEmpty(template.getDatastorages())) {
template.getDatastorages().forEach(storage -> {
storage.setParentFolderId(savedFolder.getId());
AbstractDataStorage created = dataStorageManager.create(storage, true, true, false);
if (!MapUtils.isEmpty(storage.getMetadata())) {
updateMetadata(storage.getMetadata(), new EntityVO(created.getId(), AclClass.DATA_STORAGE));
}
});
}
if (!MapUtils.isEmpty(template.getMetadata())) {
updateMetadata(template.getMetadata(), new EntityVO(savedFolder.getId(), AclClass.FOLDER));
}
if (CollectionUtils.isNotEmpty(template.getChildren())) {
template.getChildren().forEach(child -> {
Folder childFolder = new Folder();
childFolder.setParentId(folder.getId());
createFolderFromTemplate(childFolder, child);
});
}
if (CollectionUtils.isNotEmpty(template.getPermissions())) {
template.getPermissions().forEach(permission -> {
PermissionGrantVO permissionGrantVO = permissionGrantVOMapper.toPermissionGrantVO(permission);
permissionGrantVO.setId(savedFolder.getId());
permissionGrantVO.setAclClass(AclClass.FOLDER);
permissionManager.setPermissions(permissionGrantVO);
});
}
}
use of com.epam.pipeline.controller.vo.PermissionGrantVO in project cloud-pipeline by epam.
the class PipelineWithPermissionsTest method grantPermissions.
private void grantPermissions(Integer mask, String user, AclClass aclClass, Long entityId) {
PermissionGrantVO grantVO = new PermissionGrantVO();
grantVO.setAclClass(aclClass);
grantVO.setId(entityId);
grantVO.setMask(mask);
grantVO.setPrincipal(true);
grantVO.setUserName(user);
permissionManager.setPermissions(grantVO);
}
use of com.epam.pipeline.controller.vo.PermissionGrantVO in project cloud-pipeline by epam.
the class ToolGroupManager method makePrivate.
private void makePrivate(ToolGroup group) {
PermissionGrantVO grantVO = new PermissionGrantVO();
grantVO.setUserName("ROLE_USER");
grantVO.setPrincipal(false);
grantVO.setMask(AclPermission.ALL_DENYING_PERMISSIONS.getMask());
grantVO.setAclClass(AclClass.TOOL_GROUP);
grantVO.setId(group.getId());
grantPermissionManager.setPermissions(grantVO);
}
use of com.epam.pipeline.controller.vo.PermissionGrantVO in project cloud-pipeline by epam.
the class ToolApiServiceTest method setUp.
@Before
public void setUp() {
TestUtils.configureDockerClientMock(dockerClient, clientFactory);
registry = new DockerRegistry();
registry.setPath(TEST_REPO);
registry.setOwner(TEST_USER);
registryDao.createDockerRegistry(registry);
// Create SID for "test" user
testUserSid = new AclTestDao.AclSid(true, TEST_USER);
aclTestDao.createAclSid(testUserSid);
AclTestDao.AclClass registryAclClass = new AclTestDao.AclClass(DockerRegistry.class.getCanonicalName());
aclTestDao.createAclClassIfNotPresent(registryAclClass);
AclTestDao.AclObjectIdentity registryIdentity = new AclTestDao.AclObjectIdentity(testUserSid, registry.getId(), registryAclClass.getId(), null, true);
aclTestDao.createObjectIdentity(registryIdentity);
AclTestDao.AclEntry registryAclEntry = new AclTestDao.AclEntry(registryIdentity, 1, testUserSid, AclPermission.WRITE.getMask(), true);
aclTestDao.createAclEntry(registryAclEntry);
allowedGroup = new ToolGroup();
allowedGroup.setRegistryId(registry.getId());
allowedGroup.setName(TEST_GROUP_NAME);
toolGroupManager.create(allowedGroup);
PermissionGrantVO grantVO = new PermissionGrantVO();
grantVO.setAclClass(AclClass.TOOL_GROUP);
grantVO.setId(allowedGroup.getId());
grantVO.setMask(AclPermission.WRITE.getMask());
grantVO.setPrincipal(true);
grantVO.setUserName(TEST_USER);
grantPermissionManager.setPermissions(grantVO);
}
Aggregations