permissionsService Service
File: src/services/permissionsService.ts
Overview
Exports
- ServerSettings - interface export
- UserPermissions - interface export
Functions
getUserPermissions(userId: string, serverId: string)
No description available.
Parameters:
userId: stringserverId: string
Returns: Promise<UserPermissions>
/**
* Get comprehensive user permissions for a server
* Uses the new role-based permission system
*/
async function getUserPermissions(userId: string, serverId: string): Promise<UserPermissions>2
3
4
5
hasPermission(userId: string, serverId: string, permission: Permission, channelId?: string)
No description available.
Parameters:
userId: stringserverId: stringpermission: PermissionchannelId?: string
Returns: Promise<boolean>
/**
* Check if user has a specific permission
*/
async function hasPermission(
userId: string,
serverId: string,
permission: Permission,
channelId?: string
): Promise<boolean>2
3
4
5
6
7
8
9
hasPermissions(userId: string, serverId: string, permissions: Permission[], channelId?: string)
No description available.
Parameters:
userId: stringserverId: stringpermissions: Permission[]channelId?: string
Returns: Promise<boolean>
/**
* Check if user has all specified permissions
*/
async function hasPermissions(
userId: string,
serverId: string,
permissions: Permission[],
channelId?: string
): Promise<boolean>2
3
4
5
6
7
8
9
getServerSettings(serverId: string)
No description available.
Parameters:
serverId: string
Returns: Promise<ServerSettings | null>
/**
* Get server settings
*/
async function getServerSettings(serverId: string): Promise<ServerSettings | null>2
3
4
updateServerSettings(serverId: string, settings: Partial<ServerSettings>)
No description available.
Parameters:
serverId: stringsettings: Partial<ServerSettings>
Returns: Promise<boolean>
/**
* Update server settings
*/
async function updateServerSettings(serverId: string, settings: Partial<ServerSettings>): Promise<boolean>2
3
4
getDefaultServerSettings(serverId: string)
No description available.
Parameters:
serverId: string
Returns: ServerSettings
/**
* Get default server settings
*/
function getDefaultServerSettings(serverId: string): ServerSettings2
3
4
canUserCreateInvites(userId: string, serverId: string)
No description available.
Parameters:
userId: stringserverId: string
Returns: Promise<boolean>
/**
* Check if user can create invites
*/
async function canUserCreateInvites(userId: string, serverId: string): Promise<boolean>2
3
4
getInviteConstraints(userId: string, serverId: string)
No description available.
Parameters:
userId: stringserverId: string
Returns: Promise<
/**
* Get invite constraints for a user
*/
async function getInviteConstraints(userId: string, serverId: string): Promise<2
3
4
canManageMessages(userId: string, serverId: string, channelId?: string)
No description available.
Parameters:
userId: stringserverId: stringchannelId?: string
Returns: Promise<boolean>
/**
* Check if user can manage messages (edit/delete others' messages, pin)
*/
async function canManageMessages(userId: string, serverId: string, channelId?: string): Promise<boolean>2
3
4
canPinMessages(userId: string, serverId: string, channelId?: string)
No description available.
Parameters:
userId: stringserverId: stringchannelId?: string
Returns: Promise<boolean>
/**
* Check if user can pin messages
*/
async function canPinMessages(userId: string, serverId: string, channelId?: string): Promise<boolean>2
3
4
canCreateThreads(userId: string, serverId: string, channelId?: string)
No description available.
Parameters:
userId: stringserverId: stringchannelId?: string
Returns: Promise<boolean>
/**
* Check if user can create threads
*/
async function canCreateThreads(userId: string, serverId: string, channelId?: string): Promise<boolean>2
3
4
canModerateMembers(userId: string, serverId: string)
No description available.
Parameters:
userId: stringserverId: string
Returns: Promise<boolean>
/**
* Check if user can kick/ban members
*/
async function canModerateMembers(userId: string, serverId: string): Promise<boolean>2
3
4
Interfaces
ServerSettings
No description available.
interface ServerSettings {
id: string
server_id: string
default_role_id?: string
invite_permissions: {
who_can_create: 'everyone' | 'roles' | 'administrators'
allowed_roles?: string[]
default_expiration: number // minutes, 0 = never
max_expiration: number // minutes, 0 = no limit
allow_temporary: boolean
max_uses_limit: number // 0 = no limit
}
moderation_settings?: {
auto_mod_enabled: boolean
spam_filter: boolean
link_filter: boolean
}
created_at?: string
updated_at?
// ...
}2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
UserPermissions
No description available.
interface UserPermissions {
userId: string
serverId: string
permissions: Permission[]
roles: ServerRole[]
isOwner: boolean
isAdmin: boolean
}2
3
4
5
6
7
8
9
10
Source Code Insights
File Size: 9095 characters Lines of Code: 334 Imports: 3
Usage Example
import { ServerSettings, UserPermissions } from '@/services/permissionsService'
// Example usage
getUserPermissions()2
3
4
This documentation was automatically generated from the source code.
