예제 #1
0
 public T CheckOwnership(AuthenticatedRequestBase request, long id,
                         Func <IQueryable <T>, IQueryable <T> > queryConfigurator)
 {
     return(queryConfigurator(ForUser(request.UserId)).FirstOrDefault(arg => arg.Id == id) ??
            throw new UnauthorizedException($"You don't own {typeof(T).Name} with id {id}"));
 }
예제 #2
0
 public T ForUser(AuthenticatedRequestBase request, long id)
 {
     return(ForUser(request).FirstOrDefault(arg => arg.Id == id));
 }
예제 #3
0
 public T CheckOwnership(AuthenticatedRequestBase request, long id)
 {
     return(ForUser(request, id) ??
            throw new UnauthorizedException($"You don't own {typeof(T).Name} with id {id}"));
 }
예제 #4
0
 public IQueryable <T> ForUser(AuthenticatedRequestBase request)
 {
     return(ForUser(request.UserId));
 }