Skip to content
This repository was archived by the owner on Apr 22, 2022. It is now read-only.

Commit d093cba

Browse files
author
taleksashina
committed
Merge remote-tracking branch 'remotes/origin/ontos-ldiw-roles' into ontos-ldiw-acc: roles management, setup servlet, few gui fixes
1 parent 759b7e4 commit d093cba

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/main/java/accounts/VirtuosoUserManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void setDefaultGraphPermissions(String graph, int permissions)
8181
* @throws SQLException
8282
*/
8383
public void grantLOLook(String user) throws ClassNotFoundException, SQLException {
84-
executeUpdate(getConnection(), "GRANT EXECUTE ON DB.DBA.L_O_LOOK TO '" + user + "'");
84+
executeUpdate(getConnection(), "GRANT EXECUTE ON DB.DBA.L_O_LOOK TO \"" + user + "\"");
8585
}
8686

8787
@Override

src/main/java/setup/RDFStoreSetupManager.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ public void setUp(FrameworkConfiguration config, boolean reset) throws Exception
100100
userManager.createUser(config.getAuthSparqlUser(), config.getAuthSparqlPassword());
101101
userManager.setDefaultRdfPermissions(config.getAuthSparqlUser(), 3);
102102
userManager.grantRole(config.getAuthSparqlUser(), "SPARQL_UPDATE");
103+
userManager.grantLOLook(config.getAuthSparqlUser());
103104
try {
104105
userManager.grantRole("SPARQL", "SPARQL_UPDATE");
106+
userManager.grantLOLook("SPARQL");
105107
} catch (Exception e) {
106108
//role is already granted
107109
e.printStackTrace();
@@ -134,6 +136,26 @@ public void setUp(FrameworkConfiguration config, boolean reset) throws Exception
134136
settingsModel.add(componentsModel);
135137
settingsModel.add(ontologyModel);
136138

139+
// add to settings virtuoso component without users/passwords
140+
queryString = "PREFIX foaf:<http://xmlns.com/foaf/0.1/> "
141+
+ "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
142+
+ "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#> "
143+
+ "PREFIX lds:<http://stack.linkeddata.org/ldis-schema/>" + " CONSTRUCT { <"
144+
+ config.getFrameworkUri() + "> ?p ?o . " + "<" + config.getFrameworkUri()
145+
+ "> lds:integrates ?component ."
146+
+ "?component rdfs:label ?label . ?component rdf:type ?type . "
147+
+ "?component lds:providesService ?service . ?service rdf:type ?servicetype ."
148+
+ "?service lds:serviceUrl ?serviceUrl .} " + " WHERE { <"
149+
+ config.getFrameworkUri() + "> ?p ?o ." + "<" + config.getFrameworkUri()
150+
+ "> lds:integrates ?component ."
151+
+ "?component rdfs:label ?label . ?component rdf:type ?type . "
152+
+ "?component lds:providesService ?service . ?service rdf:type ?servicetype ."
153+
+ "?service lds:serviceUrl ?serviceUrl .}";
154+
QueryExecution qexec = QueryExecutionFactory.create(queryString, configurationModel);
155+
Model triples = qexec.execConstruct();
156+
settingsModel.add(triples);
157+
qexec.close();
158+
137159
// write the initial settings model (default settings for new users)
138160
ByteArrayOutputStream os = new ByteArrayOutputStream();
139161
settingsModel.write(os, "N-TRIPLES");
@@ -161,7 +183,7 @@ public void setUp(FrameworkConfiguration config, boolean reset) throws Exception
161183
+ " PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX lds: <http://stack.linkeddata.org/ldis-schema/> "
162184
+ " SELECT ?accountName ?password ?mailto ?role WHERE { ?account rdf:type gkg:Account . ?account foaf:accountName ?accountName . "
163185
+ " ?account lds:password ?password . ?account foaf:mbox ?mailto . ?account gkg:Role ?role . } ";
164-
QueryExecution qexec = QueryExecutionFactory.create(query, configurationModel);
186+
qexec = QueryExecutionFactory.create(query, configurationModel);
165187
ResultSet results = qexec.execSelect();
166188
while (results.hasNext()) {
167189
QuerySolution soln = results.next();

0 commit comments

Comments
 (0)