mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Add group support to partial permissions
This commit is contained in:
parent
c26a95ed60
commit
cee7ca2ca0
@ -42,7 +42,7 @@ namespace Kyoo.Abstractions.Models.Permissions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The group of this permission.
|
/// The group of this permission.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Group? Group { get; set; }
|
public Group Group { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ask a permission to run an action.
|
/// Ask a permission to run an action.
|
||||||
|
@ -54,6 +54,11 @@ namespace Kyoo.Abstractions.Models.Permissions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum Group
|
public enum Group
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Default group indicating no value.
|
||||||
|
/// </summary>
|
||||||
|
None,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Allow all operations on basic items types.
|
/// Allow all operations on basic items types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -93,7 +93,7 @@ namespace Kyoo.Authentication
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The group of he permission.
|
/// The group of he permission.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly Group _group = Group.Overall;
|
private Group _group;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The permissions options to retrieve default permissions.
|
/// The permissions options to retrieve default permissions.
|
||||||
@ -146,7 +146,7 @@ namespace Kyoo.Authentication
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group != null)
|
if (group is not null and not Group.None)
|
||||||
_group = group.Value;
|
_group = group.Value;
|
||||||
_options = options;
|
_options = options;
|
||||||
}
|
}
|
||||||
@ -159,6 +159,16 @@ namespace Kyoo.Authentication
|
|||||||
|
|
||||||
if (permission == null || kind == null)
|
if (permission == null || kind == null)
|
||||||
{
|
{
|
||||||
|
if (
|
||||||
|
context.HttpContext.Items["PermissionGroup"]
|
||||||
|
is Group group and not Group.None
|
||||||
|
)
|
||||||
|
_group = group;
|
||||||
|
else if (_group == Group.None)
|
||||||
|
_group = Group.Overall;
|
||||||
|
else
|
||||||
|
context.HttpContext.Items["PermissionGroup"] = _group;
|
||||||
|
|
||||||
switch (context.HttpContext.Items["PermissionType"])
|
switch (context.HttpContext.Items["PermissionType"])
|
||||||
{
|
{
|
||||||
case string perm:
|
case string perm:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user