sync full source from private myoffice
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user