public async Task CheckEntityIsOwnedByCurrentUser(IUserOwned entity) { var user = await _userAccessor.GetCurrentUserAsync(); if (user == null || entity.AppUserId != user.Id) { throw new RestException(HttpStatusCode.Unauthorized, new { user = "******" }); } }
public bool IfMine(IUserOwned activity) { return (activity.UserName == _username); }
public void checkIfMine(IUserOwned activity) { if (activity.UserName != _username) throw new Exception("id does not belong to user"); }