Пример #1
0
        public static async Task <RelayResponse> ResetPassword(PasswordReset credential, StagedUser stagedUser)
        {
            try
            {
                var client = new SigRClient(Settings.AdminSiteUrl, Settings.STSApiKey, "SiteHub");
                var data   = JsonConvert.SerializeObject(credential);

                var msg = new RelayMessage
                {
                    ApiKey     = Settings.AdminApiKey,
                    Data       = data,
                    DestSiteId = stagedUser.SiteId,
                    Identifier = stagedUser.Id,
                    Operation  = SiteOperation.ResetPW
                };

                await client.StartAsync();

                RelayResponse res = await client.ProcessRelayMessage(msg);

                return(res);
            }
            catch (Exception ex)
            {
                Utils.AddLogEntry("Error setting user status", EventLogEntryType.Error, 0, ex);
                return(new RelayResponse
                {
                    Success = false,
                    ErrorMessage = ex.Message
                });
            }
        }
Пример #2
0
        public static async Task <RelayResponse> GetUserStatus(StagedUser user)
        {
            try
            {
                var client = new SigRClient(Settings.AdminSiteUrl, Settings.STSApiKey, "SiteHub");

                var msg = new RelayMessage
                {
                    ApiKey     = Settings.AdminApiKey,
                    Data       = user.LocalGuid,
                    DestSiteId = user.SiteId,
                    Identifier = user.Upn,
                    Operation  = SiteOperation.GetUserStatus
                };

                await client.StartAsync();

                RelayResponse res = await client.ProcessRelayMessage(msg);

                return(res);
            }
            catch (Exception ex)
            {
                Utils.AddLogEntry("Error getting user status", EventLogEntryType.Error, 0, ex);
                return(new RelayResponse
                {
                    Success = false,
                    ErrorMessage = ex.Message
                });
            }
        }