feat(core): add allowGuestDemoWorkspace flag to force login (#12779)

https://github.com/user-attachments/assets/41a659c9-6def-4492-be8e-5910eb148d6f

This PR enforces login‑first access (#8716) by disabling or enabling the
guest demo workspace via Admin Server Client Page and redirecting
unauthenticated users straight to `/sign‑in`.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a configuration option to control whether guest users can create
demo workspaces.
* Updated server and client interfaces, GraphQL schema, and queries to
support the new guest demo workspace flag.

* **Bug Fixes**
* Improved sign-out behavior to redirect users appropriately based on
guest demo workspace permissions.
* Enhanced navigation flow to handle guest demo workspace access and
user authentication state.

* **Tests**
* Added tests to verify sign-out logic when guest demo workspaces are
enabled or disabled.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: liuyi <forehalo@gmail.com>
Co-authored-by: fengmk2 <fengmk2@gmail.com>
This commit is contained in:
Richard Lora
2025-06-29 10:17:18 -04:00
committed by GitHub
parent a4680d236d
commit 82b3c0d264
25 changed files with 209 additions and 34 deletions
@@ -7,6 +7,7 @@ query adminServerConfig {
baseUrl
name
features
allowGuestDemoWorkspace
type
initialized
credentialsRequirement {
@@ -32,6 +32,7 @@ export const adminServerConfigQuery = {
baseUrl
name
features
allowGuestDemoWorkspace
type
initialized
credentialsRequirement {
@@ -1822,6 +1823,7 @@ export const serverConfigQuery = {
baseUrl
name
features
allowGuestDemoWorkspace
type
initialized
credentialsRequirement {
@@ -7,6 +7,7 @@ query serverConfig {
baseUrl
name
features
allowGuestDemoWorkspace
type
initialized
credentialsRequirement {
+4
View File
@@ -2149,6 +2149,8 @@ export enum SearchTable {
export interface ServerConfigType {
__typename?: 'ServerConfigType';
/** Whether allow guest users to create demo workspaces. */
allowGuestDemoWorkspace: Scalars['Boolean']['output'];
/** fetch latest available upgradable release of server */
availableUpgrade: Maybe<ReleaseVersionType>;
/** Features for user that can be configured */
@@ -2743,6 +2745,7 @@ export type AdminServerConfigQuery = {
baseUrl: string;
name: string;
features: Array<ServerFeature>;
allowGuestDemoWorkspace: boolean;
type: ServerDeploymentType;
initialized: boolean;
availableUserFeatures: Array<FeatureType>;
@@ -4828,6 +4831,7 @@ export type ServerConfigQuery = {
baseUrl: string;
name: string;
features: Array<ServerFeature>;
allowGuestDemoWorkspace: boolean;
type: ServerDeploymentType;
initialized: boolean;
credentialsRequirement: {