mirror of https://github.com/msgbyte/tailchat
feat: 所有人身份组的管理
parent
9631081b65
commit
ef209d6b5f
@ -1,10 +0,0 @@
|
||||
import { t } from 'tailchat-shared';
|
||||
|
||||
export const permissionList = [
|
||||
{
|
||||
key: 'core.message',
|
||||
title: t('发送消息'),
|
||||
desc: t('允许成员在文字频道发送消息'),
|
||||
default: true,
|
||||
},
|
||||
];
|
@ -0,0 +1,31 @@
|
||||
import { model, t } from 'tailchat-shared';
|
||||
|
||||
/**
|
||||
* 所有人权限
|
||||
* 群组最低权限标识
|
||||
*/
|
||||
export const AllPermission = Symbol('AllPermission');
|
||||
|
||||
export const permissionList = [
|
||||
{
|
||||
key: 'core.message',
|
||||
title: t('发送消息'),
|
||||
desc: t('允许成员在文字频道发送消息'),
|
||||
default: true,
|
||||
},
|
||||
];
|
||||
|
||||
export function getDefaultPermissionList(): string[] {
|
||||
return permissionList.filter((p) => p.default).map((p) => p.key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化默认所有人身份组权限
|
||||
*/
|
||||
export async function applyDefaultFallbackGroupPermission(groupId: string) {
|
||||
await model.group.modifyGroupField(
|
||||
groupId,
|
||||
'fallbackPermissions',
|
||||
getDefaultPermissionList()
|
||||
);
|
||||
}
|
Loading…
Reference in New Issue