예제 #1
0
 public GuestAccessCodeChangedEventHandler(
     ILoggerFactory loggerFactory,
     IGuestSessionController guestSessionController,
     IGuestInviteController guestInviteController)
 {
     _logger = loggerFactory.GetLogger(this);
     _guestSessionController = guestSessionController;
     _guestInviteController  = guestInviteController;
 }
예제 #2
0
 public KickGuestsFromProjectHandler(
     INotificationService cacheNotificationService,
     ILoggerFactory loggerFactory,
     IGuestSessionController guestSessionController)
 {
     _cacheNotificationService = cacheNotificationService;
     _logger = loggerFactory.GetLogger(this);
     _guestSessionController = guestSessionController;
 }
예제 #3
0
 public SessionEndedEventHandler(
     IGuestSessionController guestSessionController,
     IProjectLobbyStateController projectLobbyStateController,
     ILoggerFactory loggerFactory)
 {
     _guestSessionController      = guestSessionController;
     _projectLobbyStateController = projectLobbyStateController;
     _logger = loggerFactory.GetLogger(this);
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="GuestSessionController" /> class.
        /// </summary>
        public ProjectGuestContextController(
            IRepositoryFactory repositoryFactory,
            IGuestSessionController guestSessionController,
            IProjectLobbyStateController projectLobbyStateController,
            IProjectGuestContextService projectGuestContextService,
            IProjectAccessApi serviceToServiceProjectAccessApi,
            IProjectApi serviceToServiceProjectApi,
            IUserApi userApi)
        {
            _guestSessionRepository = repositoryFactory.CreateRepository <GuestSession>();

            _guestSessionController      = guestSessionController;
            _projectLobbyStateController = projectLobbyStateController;

            _serviceToServiceProjectApi       = serviceToServiceProjectApi;
            _serviceToServiceProjectAccessApi = serviceToServiceProjectAccessApi;
            _userApi = userApi;
            _projectGuestContextService = projectGuestContextService;
        }
        public GuestSessionModule(
            IMetadataRegistry metadataRegistry,
            IPolicyEvaluator policyEvaluator,
            IGuestSessionController guestSessionController,
            ILoggerFactory loggerFactory)
            : base(GuestServiceBootstrapper.ServiceNameShort, metadataRegistry, policyEvaluator, loggerFactory)
        {
            // Init DI
            _guestSessionController = guestSessionController;

            // Initialize Routes
            CreateRoute("GetGuestSession", HttpMethod.Get, $"{Routing.GuestSessionsRoute}/{{id:guid}}", GetGuestSessionAsync)
            .Description("Retrieve a specific GuestSession resource.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new GuestSession()));

            CreateRoute("DeleteGuestSession", HttpMethod.Delete, $"{Routing.GuestSessionsRoute}/{{id:guid}}", DeleteGuestSessionAsync)
            .Description("Delete a specific GuestSession resource.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.InternalServerError);

            CreateRoute("UpdateGuestSession", HttpMethod.Put, $"{Routing.GuestSessionsRoute}/{{id:guid}}", UpdateGuestSessionAsync)
            .Description("Update a specific GuestSession resource.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new GuestSession()));

            CreateRoute("UpdateGuestSessionState", HttpMethod.Put, Routing.UpdateGuestSessionStateRoute, UpdateGuestSessionStateAsync)
            .Description("Updates the guest session state")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .RequestFormat(UpdateGuestSessionStateRequest.Example)
            .ResponseFormat(UpdateGuestSessionStateResponse.Example);

            CreateRoute("GetGuestSessions", HttpMethod.Get, $"{Routing.ProjectsRoute}/{{projectId:guid}}/{Routing.GuestSessionsPath}", GetGuestSessionsByProjectIdAsync)
            .Description("Gets all valid GuestSessions for a specific project, excluding those with a GuestState of PromotedToProjectMember.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new List <GuestSession> {
                new GuestSession()
            }));

            CreateRoute("GetGuestSessionsByProjectForCurrentUser", HttpMethod.Get, $"{Routing.GetGuestSessionsByProjectForCurrentUserRoute}", GetGuestSessionsByProjectIdForCurrentUserAsync)
            .Description("Gets all valid GuestSessions for a specific project and the requesting user, excluding those with a GuestState of PromotedToProjectMember.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new List <GuestSession> {
                new GuestSession()
            }));

            CreateRoute("GetGuestSessionsByProjectForUser", HttpMethod.Get, $"{Routing.GetGuestSessionsByProjectForUserRoute}", GetGuestSessionsByProjectIdForUserAsync)
            .Description("Gets all valid GuestSessions for a specific project and user.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new List <GuestSession> {
                new GuestSession()
            }));

            CreateRoute("VerifyGuest", HttpMethod.Post, Routing.VerifyGuestRoute, VerifyGuestAsync)
            .Description("Verify guest resource.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new GuestVerificationResponse()));

            CreateRoute("EmailHost", HttpMethod.Post, $"{Routing.GuestSessionsRoute}/{Routing.ProjectsPath}/{{accessCode}}/{Routing.EmailHostPath}", EmailHostAsync)
            .Description("Send email to project host.")
            .StatusCodes(HttpStatusCode.OK, HttpStatusCode.BadRequest, HttpStatusCode.Unauthorized, HttpStatusCode.Forbidden, HttpStatusCode.NotFound, HttpStatusCode.InternalServerError)
            .ResponseFormat(JsonConvert.SerializeObject(new SendHostEmailResponse()));
        }
 public GuestModeToggledEventHandler(ILoggerFactory loggerFactory, IGuestSessionController guestSessionController)
 {
     _logger = loggerFactory.GetLogger(this);
     _guestSessionController = guestSessionController;
 }