Update default permissions

This commit is contained in:
Zoe Roux 2024-02-19 15:18:39 +01:00
parent ee3d8916ed
commit 2968ca3562
4 changed files with 11 additions and 6 deletions

View File

@ -12,8 +12,8 @@ AUTHENTICATION_SECRET=4c@mraGB!KRfF@kpS8739y9FcHemKxBsqqxLbdR?
# You can input multiple api keys separated by a ,
KYOO_APIKEYS=t7H5!@4iMNsAaSJQ49pat4jprJgTcF656if#J3
DEFAULT_PERMISSIONS=overall.read
UNLOGGED_PERMISSIONS=overall.read
DEFAULT_PERMISSIONS=overall.read,overall.play
UNLOGGED_PERMISSIONS=overall.read,overall.play
THEMOVIEDB_APIKEY=
PUBLIC_BACK_URL=http://localhost:5000

View File

@ -40,6 +40,7 @@ namespace Kyoo.Authentication.Models
get
{
return Enum.GetNames<Group>()
.Where(x => x != nameof(Group.None))
.SelectMany(group =>
Enum.GetNames<Kind>().Select(kind => $"{group}.{kind}".ToLowerInvariant())
)
@ -50,12 +51,12 @@ namespace Kyoo.Authentication.Models
/// <summary>
/// The default permissions that will be given to a non-connected user.
/// </summary>
public string[] Default { get; set; } = { "overall.read" };
public string[] Default { get; set; } = { "overall.read", "overall.play" };
/// <summary>
/// Permissions applied to a new user.
/// </summary>
public string[] NewUser { get; set; } = { "overall.read" };
public string[] NewUser { get; set; } = { "overall.read", "overall.play" };
/// <summary>
/// The list of available ApiKeys.

View File

@ -44,6 +44,9 @@ namespace Kyoo.Postgresql.Migrations
principalColumn: "id",
onDelete: ReferentialAction.SetNull
);
// language=PostgreSQL
migrationBuilder.Sql("update users set permissions = ARRAY_APPEND(permissions, 'overall.play');");
}
/// <inheritdoc />

View File

@ -2,6 +2,7 @@ package src
import (
"fmt"
"log"
"os"
"os/exec"
)
@ -16,6 +17,7 @@ func Extract(path string, sha string, route string) (<-chan struct{}, error) {
}
go func() {
defer printExecTime("Starting extraction of %s", path)()
info, err := GetInfo(path, sha, route)
if err != nil {
extracted.Remove(sha)
@ -27,7 +29,6 @@ func Extract(path string, sha string, route string) (<-chan struct{}, error) {
os.MkdirAll(attachment_path, 0o644)
os.MkdirAll(subs_path, 0o755)
fmt.Printf("Extract subs and fonts for %s", path)
cmd := exec.Command(
"ffmpeg",
"-dump_attachment:t", "",
@ -47,7 +48,7 @@ func Extract(path string, sha string, route string) (<-chan struct{}, error) {
)
}
}
fmt.Printf("Starting extraction with the command: %s", cmd)
log.Printf("Starting extraction with the command: %s", cmd)
cmd.Stdout = nil
err = cmd.Run()
if err != nil {