reverted 9d0a62033101b003d2574c4605612d1d19995a90

This commit is contained in:
Ulf Gebhardt 2023-03-23 11:59:38 +01:00
parent d204e79cd5
commit 413f663e4d
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
5 changed files with 26 additions and 26 deletions

View File

@ -37,21 +37,21 @@ export enum RIGHTS {
LIST_ALL_CONTRIBUTION_MESSAGES = 'LIST_ALL_CONTRIBUTION_MESSAGES',
OPEN_CREATIONS = 'OPEN_CREATIONS',
// Admin
ADMIN_SEARCH_USERS = 'SEARCH_USERS',
ADMIN_SET_USER_ROLE = 'SET_USER_ROLE',
ADMIN_DELETE_USER = 'DELETE_USER',
ADMIN_UNDELETE_USER = 'UNDELETE_USER',
SEARCH_USERS = 'SEARCH_USERS',
SET_USER_ROLE = 'SET_USER_ROLE',
DELETE_USER = 'DELETE_USER',
UNDELETE_USER = 'UNDELETE_USER',
ADMIN_CREATE_CONTRIBUTION = 'ADMIN_CREATE_CONTRIBUTION',
ADMIN_UPDATE_CONTRIBUTION = 'ADMIN_UPDATE_CONTRIBUTION',
ADMIN_DELETE_CONTRIBUTION = 'ADMIN_DELETE_CONTRIBUTION',
ADMIN_LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS',
ADMIN_CONFIRM_CONTRIBUTION = 'CONFIRM_CONTRIBUTION',
ADMIN_SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL',
ADMIN_CREATION_TRANSACTION_LIST = 'CREATION_TRANSACTION_LIST',
ADMIN_LIST_TRANSACTION_LINKS_ADMIN = 'LIST_TRANSACTION_LINKS_ADMIN',
ADMIN_CREATE_CONTRIBUTION_LINK = 'CREATE_CONTRIBUTION_LINK',
ADMIN_DELETE_CONTRIBUTION_LINK = 'DELETE_CONTRIBUTION_LINK',
ADMIN_UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK',
LIST_UNCONFIRMED_CONTRIBUTIONS = 'LIST_UNCONFIRMED_CONTRIBUTIONS',
CONFIRM_CONTRIBUTION = 'CONFIRM_CONTRIBUTION',
SEND_ACTIVATION_EMAIL = 'SEND_ACTIVATION_EMAIL',
CREATION_TRANSACTION_LIST = 'CREATION_TRANSACTION_LIST',
LIST_TRANSACTION_LINKS_ADMIN = 'LIST_TRANSACTION_LINKS_ADMIN',
CREATE_CONTRIBUTION_LINK = 'CREATE_CONTRIBUTION_LINK',
DELETE_CONTRIBUTION_LINK = 'DELETE_CONTRIBUTION_LINK',
UPDATE_CONTRIBUTION_LINK = 'UPDATE_CONTRIBUTION_LINK',
ADMIN_CREATE_CONTRIBUTION_MESSAGE = 'ADMIN_CREATE_CONTRIBUTION_MESSAGE',
ADMIN_DENY_CONTRIBUTION = 'DENY_CONTRIBUTION',
DENY_CONTRIBUTION = 'DENY_CONTRIBUTION',
}

View File

@ -24,7 +24,7 @@ import LogError from '@/server/LogError'
@Resolver()
export class ContributionLinkResolver {
@Authorized([RIGHTS.ADMIN_CREATE_CONTRIBUTION_LINK])
@Authorized([RIGHTS.CREATE_CONTRIBUTION_LINK])
@Mutation(() => ContributionLink)
async createContributionLink(
@Args()
@ -90,7 +90,7 @@ export class ContributionLinkResolver {
}
}
@Authorized([RIGHTS.ADMIN_DELETE_CONTRIBUTION_LINK])
@Authorized([RIGHTS.DELETE_CONTRIBUTION_LINK])
@Mutation(() => Date, { nullable: true })
async deleteContributionLink(@Arg('id', () => Int) id: number): Promise<Date | null> {
const contributionLink = await DbContributionLink.findOne(id)
@ -103,7 +103,7 @@ export class ContributionLinkResolver {
return newContributionLink ? newContributionLink.deletedAt : null
}
@Authorized([RIGHTS.ADMIN_UPDATE_CONTRIBUTION_LINK])
@Authorized([RIGHTS.UPDATE_CONTRIBUTION_LINK])
@Mutation(() => ContributionLink)
async updateContributionLink(
@Args()

View File

@ -390,7 +390,7 @@ export class ContributionResolver {
return result
}
@Authorized([RIGHTS.ADMIN_LIST_UNCONFIRMED_CONTRIBUTIONS])
@Authorized([RIGHTS.LIST_UNCONFIRMED_CONTRIBUTIONS])
@Query(() => ContributionListResult) // [UnconfirmedContribution]
async adminListAllContributions(
@Args()
@ -461,7 +461,7 @@ export class ContributionResolver {
return !!res
}
@Authorized([RIGHTS.ADMIN_CONFIRM_CONTRIBUTION])
@Authorized([RIGHTS.CONFIRM_CONTRIBUTION])
@Mutation(() => Boolean)
async confirmContribution(
@Arg('id', () => Int) id: number,
@ -566,7 +566,7 @@ export class ContributionResolver {
return true
}
@Authorized([RIGHTS.ADMIN_CREATION_TRANSACTION_LIST])
@Authorized([RIGHTS.CREATION_TRANSACTION_LIST])
@Query(() => ContributionListResult)
async creationTransactionList(
@Args()
@ -612,7 +612,7 @@ export class ContributionResolver {
})
}
@Authorized([RIGHTS.ADMIN_DENY_CONTRIBUTION])
@Authorized([RIGHTS.DENY_CONTRIBUTION])
@Mutation(() => Boolean)
async denyContribution(
@Arg('id', () => Int) id: number,

View File

@ -336,7 +336,7 @@ export class TransactionLinkResolver {
)
}
@Authorized([RIGHTS.ADMIN_LIST_TRANSACTION_LINKS_ADMIN])
@Authorized([RIGHTS.LIST_TRANSACTION_LINKS_ADMIN])
@Query(() => TransactionLinkResult)
async listTransactionLinksAdmin(
@Args()

View File

@ -640,7 +640,7 @@ export class UserResolver {
}
}
@Authorized([RIGHTS.ADMIN_SEARCH_USERS])
@Authorized([RIGHTS.SEARCH_USERS])
@Query(() => SearchUsersResult)
async searchUsers(
@Args()
@ -706,7 +706,7 @@ export class UserResolver {
}
}
@Authorized([RIGHTS.ADMIN_SET_USER_ROLE])
@Authorized([RIGHTS.SET_USER_ROLE])
@Mutation(() => Date, { nullable: true })
async setUserRole(
@Arg('userId', () => Int)
@ -748,7 +748,7 @@ export class UserResolver {
return newUser ? newUser.isAdmin : null
}
@Authorized([RIGHTS.ADMIN_DELETE_USER])
@Authorized([RIGHTS.DELETE_USER])
@Mutation(() => Date, { nullable: true })
async deleteUser(
@Arg('userId', () => Int) userId: number,
@ -770,7 +770,7 @@ export class UserResolver {
return newUser ? newUser.deletedAt : null
}
@Authorized([RIGHTS.ADMIN_UNDELETE_USER])
@Authorized([RIGHTS.UNDELETE_USER])
@Mutation(() => Date, { nullable: true })
async unDeleteUser(@Arg('userId', () => Int) userId: number): Promise<Date | null> {
const user = await DbUser.findOne({ id: userId }, { withDeleted: true })
@ -785,7 +785,7 @@ export class UserResolver {
}
// TODO this is an admin function - needs refactor
@Authorized([RIGHTS.ADMIN_SEND_ACTIVATION_EMAIL])
@Authorized([RIGHTS.SEND_ACTIVATION_EMAIL])
@Mutation(() => Boolean)
async sendActivationEmail(
@Arg('email') email: string,