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

Commit f703eb0

Browse files
committed
add a function to fix update error
1 parent 71124c3 commit f703eb0

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

src/main/java/accounts/VirtuosoUserManager.java

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ public class VirtuosoUserManager implements UserManager {
1313
private Connection connection;
1414

1515
/**
16-
* This class manages the User creation in virtuoso for authentication and
17-
* graph access control
16+
* This class manages the User creation in virtuoso for authentication and graph access control
1817
*
1918
* @param connectionString
2019
* Connection string to Virtuoso
@@ -30,46 +29,62 @@ public VirtuosoUserManager(String connectionString, String user, String password
3029
}
3130

3231
@Override
33-
public void createUser(String name, String password) throws Exception {
32+
public void createUser(String name, String password) throws ClassNotFoundException, SQLException {
3433
executeUpdate(getConnection(), "DB.DBA.USER_CREATE('" + name + "', '" + password + "')");
3534
// executeUpdate(getConnection(), "USER_SET_OPTION('" + name +
3635
// "', 'DAV_ENABLE', 1)");
3736
}
3837

3938
@Override
40-
public void dropUser(String name) throws Exception {
39+
public void dropUser(String name) throws ClassNotFoundException, SQLException {
4140
executeUpdate(getConnection(), "USER_DROP('" + name + "', 1)");
4241
}
4342

4443
@Override
45-
public void grantRole(String user, String role) throws Exception {
44+
public void grantRole(String user, String role) throws ClassNotFoundException, SQLException {
4645
executeUpdate(getConnection(), "GRANT " + role + " TO \"" + user + "\"");
4746
}
4847

4948
@Override
50-
public void setDefaultRdfPermissions(String user, int permissions) throws Exception {
49+
public void setDefaultRdfPermissions(String user, int permissions) throws ClassNotFoundException,
50+
SQLException {
5151
executeUpdate(getConnection(), "DB.DBA.RDF_DEFAULT_USER_PERMS_SET ('" + user + "', "
5252
+ permissions + ")");
5353
}
5454

5555
@Override
56-
public void setRdfGraphPermissions(String user, String graph, int permissions) throws Exception {
56+
public void setRdfGraphPermissions(String user, String graph, int permissions)
57+
throws ClassNotFoundException, SQLException {
5758
executeUpdate(getConnection(), "DB.DBA.RDF_GRAPH_USER_PERMS_SET ('" + graph + "', '" + user
5859
+ "', " + permissions + ")");
5960
}
6061

6162
@Override
62-
public void deleteRdfGraphPermissions(String user, String graph) throws Exception {
63+
public void deleteRdfGraphPermissions(String user, String graph) throws ClassNotFoundException,
64+
SQLException {
6365
executeUpdate(getConnection(), "DB.DBA.RDF_GRAPH_USER_PERMS_DEL ('" + graph + "', '" + user
6466
+ "')");
6567
}
6668

6769
@Override
68-
public void setDefaultGraphPermissions(String graph, int permissions) throws Exception {
70+
public void setDefaultGraphPermissions(String graph, int permissions)
71+
throws ClassNotFoundException, SQLException {
6972
executeUpdate(getConnection(), "DB.DBA.RDF_GRAPH_USER_PERMS_SET ('" + graph + "', 'nobody', "
7073
+ permissions + ")");
7174
}
7275

76+
/**
77+
* This function grant L_O_LOOK in virtuoso which was required to solve the error: Virtuoso 42000
78+
* Error SR186: No permission to execute dpipe DB.DBA.L_O_LOOK with user ID 106, group ID 106
79+
*
80+
* @param user
81+
* @throws ClassNotFoundException
82+
* @throws SQLException
83+
*/
84+
public void grantLOLook(String user) throws ClassNotFoundException, SQLException {
85+
executeUpdate(getConnection(), "GRANT EXECUTE ON DB.DBA.L_O_LOOK TO '" + user + "'");
86+
}
87+
7388
private Connection getConnection() throws ClassNotFoundException, SQLException {
7489
if (connection == null || connection.isClosed()) {
7590
Class.forName(jdbcDriver);

0 commit comments

Comments
 (0)