コード例 #1
0
 public GuildsController(
     IPublishEndpoint publishEndpoint,
     IMapper mapper,
     ISendEndpointProvider sendEndpointProvider,
     StrifeDbContext dbContext
     )
 {
     _mapper               = mapper;
     _publishEndpoint      = publishEndpoint;
     _sendEndpointProvider = sendEndpointProvider;
     _dbContext            = dbContext;
 }
コード例 #2
0
ファイル: MessagesController.cs プロジェクト: qin-guan/Strife
 public MessagesController(
     IAuthorizationService authorizationService,
     IPublishEndpoint publishEndpoint,
     IMapper mapper,
     ISendEndpointProvider sendEndpointProvider,
     StrifeDbContext dbContext
     )
 {
     _authorizationService = authorizationService;
     _mapper               = mapper;
     _publishEndpoint      = publishEndpoint;
     _sendEndpointProvider = sendEndpointProvider;
     _dbContext            = dbContext;
 }
コード例 #3
0
ファイル: ClaimsExtension.cs プロジェクト: qin-guan/Strife
        public static async Task <List <IdentityRoleClaim <Guid> > > GetClaimsAsync(this StrifeDbContext dbContext,
                                                                                    Guid guildId, Guid userId)
        {
            // First we get all the user role joins for the user
            var userRoles = await dbContext.UserRoles.Where(ur => ur.UserId == userId).Select(ur => ur.RoleId)
                            .ToListAsync();

            // Then we get the role and filter to only include for the project
            var roles = await dbContext.Roles
                        .Where(r => userRoles.Contains(r.Id) && r.GuildId == guildId).Select(r => r.Id).ToListAsync();

            // Get all the role claims
            return(await dbContext.RoleClaims
                   .Where(r => r.ClaimType == Permission.ClaimType && roles.Contains(r.RoleId)).ToListAsync());
        }
コード例 #4
0
 public ChannelsController(
     IAuthorizationService authorizationService,
     UserManager <StrifeUser> userManager,
     StrifeDbContext dbContext,
     IPublishEndpoint publishEndpoint,
     ISendEndpointProvider sendEndpointProvider,
     IMapper mapper
     )
 {
     _authorizationService = authorizationService;
     _publishEndpoint      = publishEndpoint;
     _sendEndpointProvider = sendEndpointProvider;
     _userManager          = userManager;
     _dbContext            = dbContext;
     _mapper = mapper;
 }
コード例 #5
0
 public AddRoleUserConsumer(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #6
0
 public CreatePermissionsConsumer(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #7
0
 public CreateMessageConsumer(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #8
0
ファイル: UsersController.cs プロジェクト: qin-guan/Strife
 public UsersController(StrifeDbContext dbContext, IMapper mapper, IAuthorizationService authorizationService)
 {
     _dbContext            = dbContext;
     _mapper               = mapper;
     _authorizationService = authorizationService;
 }
コード例 #9
0
 public PermissionAuthorizationHandler(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #10
0
 public CreateGuildConsumer(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }
コード例 #11
0
 public CreateChannelConsumer(StrifeDbContext dbContext)
 {
     _dbContext = dbContext;
 }