public Authorizations getAuthorizations(User user) { Authorizations authorizations; authorizations = authorizationRepository.getGraphAuthorizations( user, VISIBILITY_STRING, UserRepository.VISIBILITY_STRING ); return authorizations; }
@Inject public ReindexLongRunningProcessWorker( Graph graph, UserRepository userRepository, AuthorizationRepository authorizationRepository ) { this.graph = graph; this.authorizations = authorizationRepository.getGraphAuthorizations(userRepository.getSystemUser()); }
public Authorizations getGraphAuthorizations(User user, String... authorizations) { return getAuthorizationRepository().getGraphAuthorizations(user, authorizations); }
@Inject public Ping( UserRepository userRepository, Graph graph, WorkQueueRepository workQueueRepository, LongRunningProcessRepository longRunningProcessRepository, PingUtil pingUtil, AuthorizationRepository authorizationRepository ) { this.graph = graph; this.workQueueRepository = workQueueRepository; this.longRunningProcessRepository = longRunningProcessRepository; this.pingUtil = pingUtil; this.authorizations = authorizationRepository.getGraphAuthorizations(userRepository.getSystemUser()); }
public static Authorizations getAuthorizations( HttpServletRequest request, UserRepository userRepository, AuthorizationRepository authorizationRepository, WorkspaceRepository workspaceRepository ) { User user = VisalloBaseParameterProvider.getUser(request, userRepository); if (user == null) { return null; } String workspaceId = VisalloBaseParameterProvider.getActiveWorkspaceIdOrDefault(request, workspaceRepository, userRepository); if (workspaceId != null) { return authorizationRepository.getGraphAuthorizations(user, workspaceId); } return authorizationRepository.getGraphAuthorizations(user); }
protected void before() { graph = InMemoryGraph.create(); when(metricsManager.counter(any())).thenReturn(mockCounter); when(metricsManager.counter(any(), any())).thenReturn(mockCounter); when(metricsManager.timer(any())).thenReturn(mockTimer); when(metricsManager.timer(any(), any())).thenReturn(mockTimer); when(metricsManager.meter(any())).thenReturn(mockMeter); when(metricsManager.meter(any(), any())).thenReturn(mockMeter); when(userRepository.getSystemUser()).thenReturn(systemUser); when(authorizationRepository.getGraphAuthorizations(systemUser)).thenReturn(systemUserAuthorizations); }
@Handle public JSONObject stats( User user ) { Authorizations authorizations = authorizationRepository.getGraphAuthorizations( user, PingUtil.VISIBILITY_STRING ); JSONObject json = new JSONObject(); int[] minutes = {1, 5, 15}; for (int i : minutes) { json.put(Integer.toString(i), pingUtil.getAverages(i, graph, authorizations)); } return json; } }
@Handle public ClientApiEdgeMultipleResponse handle( @Required(name = "edgeIds[]") String[] edgeIdsParameter, @ActiveWorkspaceId(required = false) String workspaceId, HttpServletRequest request, User user ) throws Exception { Authorizations authorizations = workspaceId != null ? authorizationRepository.getGraphAuthorizations(user, workspaceId) : authorizationRepository.getGraphAuthorizations(user); return getEdges(request, workspaceId, Sets.newHashSet(edgeIdsParameter), authorizations); }
@Override public ClientApiSearchListResponse getSavedSearches(User user) { checkNotNull(user, "User is required"); Authorizations authorizations = authorizationRepository.getGraphAuthorizations( user, VISIBILITY_STRING, UserRepository.VISIBILITY_STRING ); ClientApiSearchListResponse result = new ClientApiSearchListResponse(); Iterables.addAll(result.searches, getGlobalSavedSearches(authorizations)); Iterables.addAll(result.searches, getUserSavedSearches(user, authorizations)); return result; }
protected Authorizations getAuthorizations() { if (this.authorizations == null) { this.authorizations = getAuthorizationRepository().getGraphAuthorizations(getUser()); } return this.authorizations; }
@Override public ClientApiSearch getSavedSearch(String id, User user) { Authorizations authorizations = authorizationRepository.getGraphAuthorizations( user, VISIBILITY_STRING, UserRepository.VISIBILITY_STRING ); Vertex searchVertex = graph.getVertex(id, authorizations); if (searchVertex == null) { return null; } return toClientApiSearch(searchVertex); }
private Authorizations getAuthorizations(IngestOptions ingestOptions) { return authorizationRepository.getGraphAuthorizations(ingestOptions.getIngestUser(), ingestOptions.getAdditionalAuthorizations()); }
private void ensureOntologyDefined() { try (InputStream graphOwl = GraphWebAppPlugin.class.getResourceAsStream("graph.owl")) { byte[] inFileData = IOUtils.toByteArray(graphOwl); IRI graphIRI = IRI.create(GraphProductOntology.IRI); Authorizations authorizations = authorizationRepository.getGraphAuthorizations(this.userRepository.getSystemUser()); ontologyRepository.importFileData(inFileData, graphIRI, null, authorizations); } catch (Exception e) { throw new VisalloException("Could not read graph.owl file", e); } } }
public Vertex getProductVertex(String workspaceId, String productId, User user) { Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations( user, VISIBILITY_STRING, workspaceId ); return getGraph().getVertex(productId, authorizations); }
@Override protected void processInternal(JSONObject jsonObject) { PingLongRunningProcessQueueItem queueItem = ClientApiConverter.toClientApi( jsonObject.toString(), PingLongRunningProcessQueueItem.class ); Authorizations authorizations = authorizationRepository.getGraphAuthorizations(userRepository.getSystemUser()); Vertex vertex = graph.getVertex(queueItem.getVertexId(), authorizations); pingUtil.lrpUpdate(vertex, graph, authorizations); }
@Before public void before() throws Exception { super.before(); user = getUserRepository().getSystemUser(); authorizations = getAuthorizationRepository().getGraphAuthorizations(user); }
public void prepare(User user, GraphPropertyWorkerInitializer repository) { setUser(user); setAuthorizations(authorizationRepository.getGraphAuthorizations(user)); prepareWorkers(repository); this.getWorkQueueRepository().setGraphPropertyRunner(this); }
private Vertex getGlobalSavedSearchesRootVertex() { Authorizations authorizations = authorizationRepository.getGraphAuthorizations( userRepository.getSystemUser(), VISIBILITY_STRING ); Vertex globalSavedSearchesRootVertex = graph.getVertex(GLOBAL_SAVED_SEARCHES_ROOT_VERTEX_ID, authorizations); if (globalSavedSearchesRootVertex == null) { globalSavedSearchesRootVertex = graph.prepareVertex( GLOBAL_SAVED_SEARCHES_ROOT_VERTEX_ID, new Visibility(VISIBILITY_STRING) ) .save(authorizations); graph.flush(); } return globalSavedSearchesRootVertex; }
@Handle public ClientApiWorkspace handle( @Optional(name = "title") String title, User user ) throws Exception { Workspace workspace; workspace = workspaceRepository.add(title, user); LOGGER.info("Created workspace: %s, title: %s", workspace.getWorkspaceId(), workspace.getDisplayTitle()); Authorizations authorizations = authorizationRepository.getGraphAuthorizations(user); ClientApiWorkspace clientApiWorkspace = workspaceRepository.toClientApi(workspace, user, authorizations); workQueueRepository.pushWorkspaceChange(clientApiWorkspace, clientApiWorkspace.getUsers(), user.getUserId(), null); return clientApiWorkspace; } }
@Override public void setTitle(Workspace workspace, String title, User user) { if (!hasWritePermissions(workspace.getWorkspaceId(), user)) { throw new VisalloAccessDeniedException( "user " + user.getUserId() + " does not have write access to workspace " + workspace.getWorkspaceId(), user, workspace.getWorkspaceId() ); } Authorizations authorizations = getAuthorizationRepository().getGraphAuthorizations(user); Vertex workspaceVertex = getVertexFromWorkspace(workspace, false, authorizations); WorkspaceProperties.TITLE.setProperty(workspaceVertex, title, VISIBILITY.getVisibility(), authorizations); getGraph().flush(); }