public async Task Add(int userId, string connectionId)
 {
     _storage.Add(connectionId, new UserConnectionModel
     {
         UserId     = userId,
         ProjectIds = await _permissionsDataAccessor.Get().Where(x => x.UserId == userId).Select(x => x.ProjectId).Distinct().ToArrayAsync()
     });
 }
Exemplo n.º 2
0
 public IQueryable <IProject> Get(int userId, Permission?permission = null)
 {
     return(_projectsDataAccessor.Get().Where(x => x.CreatorId == userId ||
                                              _permissionsDataAccessor.Get().Any(y =>
                                                                                 y.ProjectId == x.Id && y.UserId == userId &&
                                                                                 (!permission.HasValue || permission == y.Permission ||
                                                                                  y.Permission == Permission.Admin))));
 }
Exemplo n.º 3
0
 public IQueryable <Permission> Get(int userId, int projectId)
 {
     return(_permissionsDataAccessor.Get(userId, projectId));
 }