コード例 #1
0
        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 = "******" });
            }
        }
コード例 #2
0
 public bool IfMine(IUserOwned activity)
 {
     return (activity.UserName == _username);
 }
コード例 #3
0
 public void checkIfMine(IUserOwned activity)
 {
     if (activity.UserName != _username) throw new Exception("id does not belong to user");
 }