Files
myoffice_public/MyOffice.Services/Account/AccountAcl.cs
T

19 lines
597 B
C#

namespace MyOffice.Services.Account;
using Data.Models.Accounts;
/// <summary>
/// Account access checks shared by service mutations (motions, settings, invites).
/// </summary>
public static class AccountAcl
{
public static AccountAccess? GetUserAccess(Account account, Guid userId) =>
account.AccessRights?.FirstOrDefault(x => x.UserId == userId);
public static bool CanWrite(Account account, Guid userId) =>
GetUserAccess(account, userId)?.IsAllowWrite == true;
public static bool CanManage(Account account, Guid userId) =>
GetUserAccess(account, userId)?.IsAllowManage == true;
}