新增站内发送权限
This commit is contained in:
@@ -53,7 +53,8 @@ const en = {
|
||||
botVerifyFail: 'Bot verification failed, please try again',
|
||||
authExpired: 'Authentication has expired. Please sign in again',
|
||||
unauthorized: 'Unauthorized',
|
||||
bannedSend: 'You do not have permission to send emails',
|
||||
bannedSend: 'You can only send emails to internal mailboxes',
|
||||
onlyInternalSend: 'Your current role allows sending internal emails only',
|
||||
noDomainPermAdd: "No permission to add this domain email",
|
||||
noDomainPermReg: "No permission to register this domain email",
|
||||
noDomainPermRegKey: "Registration code not valid for this domain",
|
||||
|
||||
@@ -53,7 +53,8 @@ const zh = {
|
||||
botVerifyFail: '人机验证失败,请重试',
|
||||
authExpired: '身份认证失效,请重新登录',
|
||||
unauthorized: '权限不足',
|
||||
bannedSend: '你没有发送邮件权限',
|
||||
bannedSend: '你没有邮件发送权限',
|
||||
onlyInternalSend: '权限不足,只能给站内邮箱发件',
|
||||
noDomainPermAdd: '你没有权限添加该域名邮箱',
|
||||
noDomainPermReg: '你没有权限注册该域名邮箱',
|
||||
noDomainPermRegKey: '你的注册码没有权限注册该域名邮箱',
|
||||
|
||||
@@ -175,9 +175,24 @@ const emailService = {
|
||||
const userRow = await userService.selectById(c, userId);
|
||||
const roleRow = await roleService.selectById(c, userRow.type);
|
||||
|
||||
//如果不是管理员,发送被禁用
|
||||
if (c.env.admin !== userRow.email && roleRow.sendType === 'ban') {
|
||||
throw new BizError(t('bannedSend'), 403);
|
||||
//判断接收方是不是全部为站内邮箱
|
||||
const allInternal = receiveEmail.every(email => {
|
||||
const domain = '@' + emailUtils.getDomain(email);
|
||||
return domainList.includes(domain);
|
||||
});
|
||||
|
||||
if (c.env.admin !== userRow.email) {
|
||||
|
||||
//发件被禁用
|
||||
if (roleRow.sendType === 'ban') {
|
||||
throw new BizError(t('bannedSend'), 403);
|
||||
}
|
||||
|
||||
//发件被禁用
|
||||
if (roleRow.sendType === 'internal' && !allInternal) {
|
||||
throw new BizError(t('onlyInternalSend'), 403);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//如果不是管理员,权限设置了发送次数
|
||||
@@ -213,12 +228,6 @@ const emailService = {
|
||||
|
||||
}
|
||||
|
||||
//判断接收方是不是全部为站内邮箱
|
||||
const allInternal = receiveEmail.every(email => {
|
||||
const domain = '@' + emailUtils.getDomain(email);
|
||||
return domainList.includes(domain);
|
||||
});
|
||||
|
||||
const domain = emailUtils.getDomain(accountRow.email);
|
||||
const resendToken = resendTokens[domain];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user