mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Add guest permissions to server info
This commit is contained in:
parent
df6f9ea71d
commit
158058b720
@ -31,6 +31,11 @@ public class ServerInfo
|
|||||||
/// True if guest accounts are allowed on this instance.
|
/// True if guest accounts are allowed on this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool AllowGuests { get; set; }
|
public bool AllowGuests { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The list of permissions available for the guest account.
|
||||||
|
/// </summary>
|
||||||
|
public List<string> GuestPermissions { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OidcInfo
|
public class OidcInfo
|
||||||
|
@ -39,6 +39,7 @@ public class InfoApi(PermissionOption options) : ControllerBase
|
|||||||
new ServerInfo()
|
new ServerInfo()
|
||||||
{
|
{
|
||||||
AllowGuests = options.Default.Any(),
|
AllowGuests = options.Default.Any(),
|
||||||
|
GuestPermissions = options.Default.ToList(),
|
||||||
Oidc = options
|
Oidc = options
|
||||||
.OIDC.Select(x => new KeyValuePair<string, OidcInfo>(
|
.OIDC.Select(x => new KeyValuePair<string, OidcInfo>(
|
||||||
x.Key,
|
x.Key,
|
||||||
|
@ -37,22 +37,24 @@ export const ServerInfoP = z.object({
|
|||||||
* True if guest accounts are allowed on this instance.
|
* True if guest accounts are allowed on this instance.
|
||||||
*/
|
*/
|
||||||
allowGuests: z.boolean(),
|
allowGuests: z.boolean(),
|
||||||
|
/*
|
||||||
|
* The list of permissions available for the guest account.
|
||||||
|
*/
|
||||||
|
guestPermissions: z.array(z.string()),
|
||||||
/*
|
/*
|
||||||
* The list of oidc providers configured for this instance of kyoo.
|
* The list of oidc providers configured for this instance of kyoo.
|
||||||
*/
|
*/
|
||||||
oidc: z
|
oidc: z.record(z.string(), OidcInfoP).transform((x) =>
|
||||||
.record(z.string(), OidcInfoP)
|
Object.fromEntries(
|
||||||
.transform((x) =>
|
Object.entries(x).map(([provider, info]) => [
|
||||||
Object.fromEntries(
|
provider,
|
||||||
Object.entries(x).map(([provider, info]) => [
|
{
|
||||||
provider,
|
...info,
|
||||||
{
|
link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`),
|
||||||
...info,
|
},
|
||||||
link: imageFn(`/auth/login/${provider}?redirectUrl=${baseAppUrl()}/login/callback`),
|
]),
|
||||||
},
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user