use of org.eclipse.vorto.repository.domain.NamespaceRole in project vorto by eclipse.
the class SearchTestInfrastructure method setupNamespaceMocking.
private void setupNamespaceMocking() throws OperationForbiddenException, DoesNotExistException {
when(namespaceService.resolveWorkspaceIdForNamespace(anyString())).thenReturn(Optional.of("playground"));
when(namespaceService.findNamespaceByWorkspaceId(anyString())).thenReturn(mockNamespace());
when(namespaceRepository.findAll()).thenReturn(Arrays.asList(mockNamespace()));
when(userNamespaceRoleService.hasRole(anyString(), any(), any())).thenReturn(true);
when(userNamespaceRoleService.getNamespaces(anyString(), anyString())).thenReturn(Arrays.asList(mockNamespace()));
List<String> workspaceIds = new ArrayList<>();
workspaceIds.add("playground");
when(namespaceService.findAllWorkspaceIds()).thenReturn(workspaceIds);
NamespaceRole role = new NamespaceRole();
role.setName("namespace_admin");
role.setPrivileges(7);
role.setRole(32);
Set<IRole> roles = new HashSet<>();
roles.add(role);
when(userNamespaceRoleService.getRoles(anyString(), anyString())).thenReturn(roles);
when(userNamespaceRoleService.getRoles(any(User.class), any(Namespace.class))).thenReturn(roles);
Set<Privilege> privileges = new HashSet<>(Arrays.asList(Privilege.DEFAULT_PRIVILEGES));
when(privilegeService.getPrivileges(anyLong())).thenReturn(privileges);
}
use of org.eclipse.vorto.repository.domain.NamespaceRole in project vorto by eclipse.
the class RoleProvider method modelReviewer.
public static NamespaceRole modelReviewer() {
NamespaceRole model_reviewer = new NamespaceRole();
model_reviewer.setName("model_reviewer");
model_reviewer.setPrivileges(3);
model_reviewer.setRole(8);
return model_reviewer;
}
use of org.eclipse.vorto.repository.domain.NamespaceRole in project vorto by eclipse.
the class RoleProvider method modelPublisher.
public static NamespaceRole modelPublisher() {
NamespaceRole model_publisher = new NamespaceRole();
model_publisher.setName("model_publisher");
model_publisher.setPrivileges(3);
model_publisher.setRole(4);
return model_publisher;
}
use of org.eclipse.vorto.repository.domain.NamespaceRole in project vorto by eclipse.
the class RoleProvider method namespaceAdmin.
public static NamespaceRole namespaceAdmin() {
NamespaceRole namespace_admin = new NamespaceRole();
namespace_admin.setName("namespace_admin");
namespace_admin.setPrivileges(7);
namespace_admin.setRole(32);
return namespace_admin;
}
use of org.eclipse.vorto.repository.domain.NamespaceRole in project vorto by eclipse.
the class RoleProvider method modelViewer.
public static NamespaceRole modelViewer() {
NamespaceRole model_viewer = new NamespaceRole();
model_viewer.setName("model_viewer");
model_viewer.setPrivileges(1);
model_viewer.setRole(1);
return model_viewer;
}
Aggregations