* 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
780 B
C#
28 lines
780 B
C#
using MareSynchronos.API.Data.Enum;
|
|
|
|
namespace MareSynchronos.API.Data.Extensions;
|
|
|
|
public static class GroupUserInfoExtensions
|
|
{
|
|
public static bool IsModerator(this GroupUserInfo info)
|
|
{
|
|
return info.HasFlag(GroupUserInfo.IsModerator);
|
|
}
|
|
|
|
public static bool IsPinned(this GroupUserInfo info)
|
|
{
|
|
return info.HasFlag(GroupUserInfo.IsPinned);
|
|
}
|
|
|
|
public static void SetModerator(this ref GroupUserInfo info, bool isModerator)
|
|
{
|
|
if (isModerator) info |= GroupUserInfo.IsModerator;
|
|
else info &= ~GroupUserInfo.IsModerator;
|
|
}
|
|
|
|
public static void SetPinned(this ref GroupUserInfo info, bool isPinned)
|
|
{
|
|
if (isPinned) info |= GroupUserInfo.IsPinned;
|
|
else info &= ~GroupUserInfo.IsPinned;
|
|
}
|
|
} |