mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 01:39:37 +02:00

* Comments and videos can be automatically tagged using core rules or watched word lists * These tags can be used to automatically filter videos and comments * Introduce a new video comment policy where comments must be approved first * Comments may have to be approved if the user auto block them using core rules or watched word lists * Implement FEP-5624 to federate reply control policies
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { UserRight, UserRightType, UserRole, UserRoleType } from '@peertube/peertube-models'
|
|
|
|
export const USER_ROLE_LABELS: { [ id in UserRoleType ]: string } = {
|
|
[UserRole.USER]: 'User',
|
|
[UserRole.MODERATOR]: 'Moderator',
|
|
[UserRole.ADMINISTRATOR]: 'Administrator'
|
|
}
|
|
|
|
const userRoleRights: { [ id in UserRoleType ]: UserRightType[] } = {
|
|
[UserRole.ADMINISTRATOR]: [
|
|
UserRight.ALL
|
|
],
|
|
|
|
[UserRole.MODERATOR]: [
|
|
UserRight.MANAGE_VIDEO_BLACKLIST,
|
|
UserRight.MANAGE_ABUSES,
|
|
UserRight.MANAGE_ANY_VIDEO_CHANNEL,
|
|
UserRight.REMOVE_ANY_VIDEO,
|
|
UserRight.REMOVE_ANY_VIDEO_PLAYLIST,
|
|
UserRight.MANAGE_ANY_VIDEO_COMMENT,
|
|
UserRight.UPDATE_ANY_VIDEO,
|
|
UserRight.SEE_ALL_VIDEOS,
|
|
UserRight.MANAGE_ACCOUNTS_BLOCKLIST,
|
|
UserRight.MANAGE_SERVERS_BLOCKLIST,
|
|
UserRight.MANAGE_USERS,
|
|
UserRight.SEE_ALL_COMMENTS,
|
|
UserRight.MANAGE_REGISTRATIONS,
|
|
UserRight.MANAGE_INSTANCE_WATCHED_WORDS,
|
|
UserRight.MANAGE_INSTANCE_AUTO_TAGS
|
|
],
|
|
|
|
[UserRole.USER]: []
|
|
}
|
|
|
|
export function hasUserRight (userRole: UserRoleType, userRight: UserRightType) {
|
|
const userRights = userRoleRights[userRole]
|
|
|
|
return userRights.includes(UserRight.ALL) || userRights.includes(userRight)
|
|
}
|