* add jwt expiry * bump api version * start rework permissions * ok so in theory this compiles * update api * update api * update api * update api once more * oh apiii I hate submodules * blabla * we only live to suffer * stop reading my commit messages * nothing to see here move along * update nuget * some rework --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
using MareSynchronos.API.Data.Enum;
|
|
|
|
namespace MareSynchronos.API.Data.Extensions;
|
|
|
|
public static class GroupUserPermissionsExtensions
|
|
{
|
|
public static bool IsDisableAnimations(this GroupUserPreferredPermissions perm)
|
|
{
|
|
return perm.HasFlag(GroupUserPreferredPermissions.DisableAnimations);
|
|
}
|
|
|
|
public static bool IsDisableSounds(this GroupUserPreferredPermissions perm)
|
|
{
|
|
return perm.HasFlag(GroupUserPreferredPermissions.DisableSounds);
|
|
}
|
|
|
|
public static bool IsDisableVFX(this GroupUserPreferredPermissions perm)
|
|
{
|
|
return perm.HasFlag(GroupUserPreferredPermissions.DisableVFX);
|
|
}
|
|
|
|
public static bool IsPaused(this GroupUserPreferredPermissions perm)
|
|
{
|
|
return perm.HasFlag(GroupUserPreferredPermissions.Paused);
|
|
}
|
|
|
|
public static void SetDisableAnimations(this ref GroupUserPreferredPermissions perm, bool set)
|
|
{
|
|
if (set) perm |= GroupUserPreferredPermissions.DisableAnimations;
|
|
else perm &= ~GroupUserPreferredPermissions.DisableAnimations;
|
|
}
|
|
|
|
public static void SetDisableSounds(this ref GroupUserPreferredPermissions perm, bool set)
|
|
{
|
|
if (set) perm |= GroupUserPreferredPermissions.DisableSounds;
|
|
else perm &= ~GroupUserPreferredPermissions.DisableSounds;
|
|
}
|
|
|
|
public static void SetDisableVFX(this ref GroupUserPreferredPermissions perm, bool set)
|
|
{
|
|
if (set) perm |= GroupUserPreferredPermissions.DisableVFX;
|
|
else perm &= ~GroupUserPreferredPermissions.DisableVFX;
|
|
}
|
|
|
|
public static void SetPaused(this ref GroupUserPreferredPermissions perm, bool set)
|
|
{
|
|
if (set) perm |= GroupUserPreferredPermissions.Paused;
|
|
else perm &= ~GroupUserPreferredPermissions.Paused;
|
|
}
|
|
} |