mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
feature: Delete_user_as_admin_through_API_only
This commit is contained in:
parent
066506838f
commit
3d8fe4d850
@ -133,7 +133,7 @@ export default shield(
|
|||||||
CreateComment: isAuthenticated,
|
CreateComment: isAuthenticated,
|
||||||
UpdateComment: isAuthor,
|
UpdateComment: isAuthor,
|
||||||
DeleteComment: isAuthor,
|
DeleteComment: isAuthor,
|
||||||
DeleteUser: isDeletingOwnAccount,
|
DeleteUser: or(isDeletingOwnAccount, isAdmin),
|
||||||
requestPasswordReset: allow,
|
requestPasswordReset: allow,
|
||||||
resetPassword: allow,
|
resetPassword: allow,
|
||||||
AddPostEmotions: isAuthenticated,
|
AddPostEmotions: isAuthenticated,
|
||||||
|
|||||||
@ -175,6 +175,7 @@ export default {
|
|||||||
DeleteUser: async (object, params, context, resolveInfo) => {
|
DeleteUser: async (object, params, context, resolveInfo) => {
|
||||||
const { resource } = params
|
const { resource } = params
|
||||||
const session = context.driver.session()
|
const session = context.driver.session()
|
||||||
|
const { id: userId } = params
|
||||||
try {
|
try {
|
||||||
if (resource && resource.length) {
|
if (resource && resource.length) {
|
||||||
await session.writeTransaction(transaction => {
|
await session.writeTransaction(transaction => {
|
||||||
@ -190,7 +191,7 @@ export default {
|
|||||||
RETURN author
|
RETURN author
|
||||||
`,
|
`,
|
||||||
{
|
{
|
||||||
userId: context.user.id,
|
userId,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
@ -212,7 +213,7 @@ export default {
|
|||||||
DETACH DELETE socialMedia
|
DETACH DELETE socialMedia
|
||||||
RETURN user
|
RETURN user
|
||||||
`,
|
`,
|
||||||
{ userId: context.user.id },
|
{ userId },
|
||||||
)
|
)
|
||||||
log(deleteUserTransactionResponse)
|
log(deleteUserTransactionResponse)
|
||||||
return deleteUserTransactionResponse.records.map(record => record.get('user').properties)
|
return deleteUserTransactionResponse.records.map(record => record.get('user').properties)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user