* start with group permissions implementation * refactor group dto stuff * adjustments to api as necessary from client * more api refactor for UserData * use implicit usings and file scoped namespaces * fix userpermissionsextensions * fix extenions * add more comparers * adjust comparers * remove admin stuff (tbd migration to discord bot) * adjust extensions * code style for api --------- Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
28 lines
761 B
C#
28 lines
761 B
C#
using MareSynchronos.API.Data.Enum;
|
|
|
|
namespace MareSynchronos.API.Data.Extensions;
|
|
|
|
public static class UserPermissionsExtensions
|
|
{
|
|
public static bool IsPaired(this UserPermissions perm)
|
|
{
|
|
return perm.HasFlag(UserPermissions.Paired);
|
|
}
|
|
|
|
public static bool IsPaused(this UserPermissions perm)
|
|
{
|
|
return perm.HasFlag(UserPermissions.Paused);
|
|
}
|
|
|
|
public static void SetPaired(this ref UserPermissions perm, bool paired)
|
|
{
|
|
if (paired) perm |= UserPermissions.Paired;
|
|
else perm &= ~UserPermissions.Paired;
|
|
}
|
|
|
|
public static void SetPaused(this ref UserPermissions perm, bool paused)
|
|
{
|
|
if (paused) perm |= UserPermissions.Paused;
|
|
else perm &= ~UserPermissions.Paused;
|
|
}
|
|
} |