Skip to content

Commit

Permalink
Merge pull request #198 from pe4cey/update-security-procedures
Browse files Browse the repository at this point in the history
Update security procedure names
  • Loading branch information
oskarhane authored Sep 1, 2016
2 parents e4c1c69 + dd9191f commit b102b1c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/scripts/controllers/Main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ angular.module('neo4jApp.controllers')
).then( ->
fetchJMX()
).then( ->
if 'dbms.listUsers' in $scope.procedures
if 'dbms.security.listUsers' in $scope.procedures
ProtocolFactory.getStoredProcedureService().getUser().then((res) ->
$scope.user = res
Features.showAdmin = 'admin' in res.roles
Expand Down
20 changes: 10 additions & 10 deletions app/scripts/services/UtilityBolt.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -70,71 +70,71 @@ angular.module('neo4jApp.services')

getUser: ->
q = $q.defer()
Bolt.boltTransaction('CALL dbms.showCurrentUser()').promise
Bolt.boltTransaction('CALL dbms.security.showCurrentUser()').promise
.then((r) -> q.resolve Bolt.constructUserResult r)
.catch((e) -> q.reject Bolt.constructResult e)
q.promise


getUserList: ->
q = $q.defer()
Bolt.boltTransaction('CALL dbms.listUsers()').promise
Bolt.boltTransaction('CALL dbms.security.listUsers()').promise
.then((r) -> q.resolve Bolt.constructUserListResult r)
.catch((e) -> q.reject Bolt.constructResult e)
q.promise

getRolesList: ->
q = $q.defer()
Bolt.boltTransaction('CALL dbms.listRoles() YIELD role').promise
Bolt.boltTransaction('CALL dbms.security.listRoles() YIELD role').promise
.then((r) -> q.resolve Bolt.constructRolesListResult r)
.catch((e) -> q.reject Bolt.constructResult e)
q.promise

addNewUser: (username, password, requirePasswordChange) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.createUser({username}, {password}, {requirePasswordChange})", {username: username, password: password, requirePasswordChange: requirePasswordChange}).promise
Bolt.boltTransaction("CALL dbms.security.createUser({username}, {password}, {requirePasswordChange})", {username: username, password: password, requirePasswordChange: requirePasswordChange}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject Bolt.constructResult e)
q.promise

changeUserPassword: (username, password) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.changeUserPassword({username}, {password})", {username: username, password: password}).promise
Bolt.boltTransaction("CALL dbms.security.changeUserPassword({username}, {password})", {username: username, password: password}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject Bolt.constructResult e)
q.promise

activateUser: (username) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.activateUser({username})", {username: username}).promise
Bolt.boltTransaction("CALL dbms.security.activateUser({username})", {username: username}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject (Bolt.constructResult e).data)
q.promise

suspendUser: (username) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.suspendUser({username})", {username: username}).promise
Bolt.boltTransaction("CALL dbms.security.suspendUser({username})", {username: username}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject (Bolt.constructResult e).data)
q.promise

deleteUser: (username) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.deleteUser({username})", {username: username}).promise
Bolt.boltTransaction("CALL dbms.security.deleteUser({username})", {username: username}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject (Bolt.constructResult e).data)
q.promise

addUserToRole: (username, role) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.addUserToRole({username}, {role})", {username: username, role: role}).promise
Bolt.boltTransaction("CALL dbms.security.addRoleToUser({role}, {username})", {username: username, role: role}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject (Bolt.constructResult e).data)
q.promise

removeRoleFromUser: (username, role) ->
q = $q.defer()
Bolt.boltTransaction("CALL dbms.removeUserFromRole({username}, {role})", {username: username, role: role}).promise
Bolt.boltTransaction("CALL dbms.security.removeRoleFromUser({role}, {username})", {username: username, role: role}).promise
.then((r) -> q.resolve r)
.catch((e) -> q.reject (Bolt.constructResult e).data)
q.promise
Expand Down
20 changes: 10 additions & 10 deletions app/scripts/services/UtilityREST.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ angular.module('neo4jApp.services')

getUser: ->
q = $q.defer()
Server.cypher('', { query: 'CALL dbms.showCurrentUser()'}).then(
Server.cypher('', { query: 'CALL dbms.security.showCurrentUser()'}).then(
(res) ->
data = res.data
user = data.data[0]
Expand All @@ -42,7 +42,7 @@ angular.module('neo4jApp.services')
q.promise
getUserList: ->
q = $q.defer()
Server.cypher('', { query: 'CALL dbms.listUsers()'}).then(
Server.cypher('', { query: 'CALL dbms.security.listUsers()'}).then(
(res) ->
data = res.data
users = data.data.map((user) ->
Expand All @@ -58,7 +58,7 @@ angular.module('neo4jApp.services')

getRolesList: ->
q = $q.defer()
Server.cypher('', { query: 'CALL dbms.listRoles() YIELD role'}).then(
Server.cypher('', { query: 'CALL dbms.security.listRoles() YIELD role'}).then(
(res) ->
data = res.data
users = data.data.map((v) -> v[0])
Expand All @@ -85,26 +85,26 @@ angular.module('neo4jApp.services')
q.promise

changeUserPassword: (username, password) ->
@callUserAdminProcedure("CALL dbms.changeUserPassword({username}, {password})", {username: username, password: password})
@callUserAdminProcedure("CALL dbms.security.changeUserPassword({username}, {password})", {username: username, password: password})

addNewUser: (username, password, requirePasswordChange) ->
@callUserAdminProcedure("CALL dbms.createUser({username}, {password}, {requirePasswordChange})", {username: username, password: password, requirePasswordChange: requirePasswordChange})
@callUserAdminProcedure("CALL dbms.security.createUser({username}, {password}, {requirePasswordChange})", {username: username, password: password, requirePasswordChange: requirePasswordChange})

suspendUser: (username) ->
@callUserAdminProcedure("CALL dbms.suspendUser({username})", {username: username})
@callUserAdminProcedure("CALL dbms.security.suspendUser({username})", {username: username})


deleteUser: (username) ->
@callUserAdminProcedure("CALL dbms.deleteUser({username})", {username: username})
@callUserAdminProcedure("CALL dbms.security.deleteUser({username})", {username: username})

activateUser: (username) ->
@callUserAdminProcedure("CALL dbms.activateUser({username})", {username: username})
@callUserAdminProcedure("CALL dbms.security.activateUser({username})", {username: username})

addUserToRole: (username, role) ->
@callUserAdminProcedure("CALL dbms.addUserToRole({username}, {role})", {username: username, role:role})
@callUserAdminProcedure("CALL dbms.security.addRoleToUser({role}, {username})", {username: username, role:role})

removeRoleFromUser: (username, role) ->
@callUserAdminProcedure("CALL dbms.removeUserFromRole({username}, {role})", {username: username, role:role})
@callUserAdminProcedure("CALL dbms.security.removeRoleFromUser({role}, {username})", {username: username, role:role})

getProceduresList: ->
q = $q.defer()
Expand Down

0 comments on commit b102b1c

Please sign in to comment.