public static void VerifyResourceAccess(this IUserPermissionContext permissionContext, IEnumerable<int> ownerIds) { permissionContext.VerifyLogin(); if (!ownerIds.Contains(permissionContext.LoggedUserId)) throw new NotAllowedException("You do not have access to this resource."); }
private User GetLoggedUser(IRepositoryContext <SongList> ctx) { permissionContext.VerifyLogin(); return(ctx.OfType <User>().Load(permissionContext.LoggedUser.Id)); }
public static async Task <User> GetLoggedUserAsync(this IDatabaseContext <User> ctx, IUserPermissionContext permissionContext) { permissionContext.VerifyLogin(); return(await ctx.LoadAsync(permissionContext.LoggedUserId)); }
public static User GetLoggedUser(this IDatabaseContext <User> ctx, IUserPermissionContext permissionContext) { permissionContext.VerifyLogin(); return(ctx.Load(permissionContext.LoggedUserId)); }