mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-17 15:53:42 +01:00
set roles on connect endpoints
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using ServiceStack.Web;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
@@ -13,6 +14,8 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <value><c>true</c> if [allow local]; otherwise, <c>false</c>.</value>
|
||||
public bool AllowLocal { get; set; }
|
||||
|
||||
public string Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The request filter is executed before the service.
|
||||
/// </summary>
|
||||
@@ -21,7 +24,11 @@ namespace MediaBrowser.Controller.Net
|
||||
/// <param name="requestDto">The request DTO</param>
|
||||
public void RequestFilter(IRequest request, IResponse response, object requestDto)
|
||||
{
|
||||
AuthService.Authenticate(request, response, requestDto, AllowLocal);
|
||||
var roles = (Roles ?? string.Empty).Split(',')
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.ToArray();
|
||||
|
||||
AuthService.Authenticate(request, response, requestDto, AllowLocal, roles);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
using ServiceStack.Web;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Net
|
||||
{
|
||||
public interface IAuthService
|
||||
{
|
||||
void Authenticate(IRequest request, IResponse response, object requestDto, bool allowLocal);
|
||||
void Authenticate(IRequest request,
|
||||
IResponse response,
|
||||
object requestDto,
|
||||
bool allowLocal,
|
||||
string[] roles);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user