mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:59:03 +00:00
Add change password option for admins
This commit is contained in:
@@ -104,6 +104,26 @@ const Mutation = {
|
||||
|
||||
return neo4jgraphql(root, args, ctx, info)
|
||||
},
|
||||
async changeUserPassword(root, args, ctx, info) {
|
||||
const { newPassword, id } = args
|
||||
|
||||
const session = ctx.driver.session()
|
||||
|
||||
await session.run(
|
||||
`MATCH (u:User { id: {id} }) SET u.password = {newPassword}`,
|
||||
{
|
||||
id,
|
||||
newPassword,
|
||||
}
|
||||
)
|
||||
|
||||
session.close
|
||||
|
||||
return {
|
||||
success: true,
|
||||
errorMessage: null,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
export const registerUser = Mutation.registerUser
|
||||
|
||||
@@ -112,6 +112,9 @@ type Mutation {
|
||||
createUser(id: ID, username: String, rootPath: String, admin: Boolean): User
|
||||
@hasRole(roles: [admin])
|
||||
deleteUser(id: ID!): User @hasRole(roles: [admin])
|
||||
|
||||
changeUserPassword(id: ID!, newPassword: String!): Result
|
||||
@hasRole(roles: [admin])
|
||||
}
|
||||
|
||||
type Query {
|
||||
|
||||
Reference in New Issue
Block a user