feat: add access control to channels with various modes
- Introduced AccessMode enum to define channel access levels: Public, PasswordProtected, AccountRequired, and OwnerOnly. - Updated Channel and ProgrammingBlock entities to include access_mode and access_password_hash fields. - Enhanced create and update channel functionality to handle access mode and password. - Implemented access checks in channel routes based on the defined access modes. - Modified frontend components to support channel creation and editing with access control options. - Added ChannelPasswordModal for handling password input when accessing restricted channels. - Updated API calls to include channel and block passwords as needed. - Created database migrations to add access_mode and access_password_hash columns to channels table.
This commit is contained in:
@@ -107,9 +107,17 @@ export default function DashboardPage() {
|
||||
name: string;
|
||||
timezone: string;
|
||||
description: string;
|
||||
access_mode?: import("@/lib/types").AccessMode;
|
||||
access_password?: string;
|
||||
}) => {
|
||||
createChannel.mutate(
|
||||
{ name: data.name, timezone: data.timezone, description: data.description || undefined },
|
||||
{
|
||||
name: data.name,
|
||||
timezone: data.timezone,
|
||||
description: data.description || undefined,
|
||||
access_mode: data.access_mode,
|
||||
access_password: data.access_password,
|
||||
},
|
||||
{ onSuccess: () => setCreateOpen(false) },
|
||||
);
|
||||
};
|
||||
@@ -123,6 +131,8 @@ export default function DashboardPage() {
|
||||
schedule_config: { blocks: ProgrammingBlock[] };
|
||||
recycle_policy: RecyclePolicy;
|
||||
auto_schedule: boolean;
|
||||
access_mode?: import("@/lib/types").AccessMode;
|
||||
access_password?: string;
|
||||
},
|
||||
) => {
|
||||
updateChannel.mutate(
|
||||
|
||||
Reference in New Issue
Block a user