public UserProfileApiController(IUserProfilesService service
                                 , ILogger <UserProfileApiController> logger
                                 , IAuthenticationService <int> authService) : base(logger)
 {
     _service     = service;
     _authService = authService;
 }
Esempio n. 2
0
 public ChatHub(IMessageService service, ILogger <ChatHub> logger, IAuthenticationService <int> authService, IChatHubService chatHubService, IUserProfilesService profileService, IVideoChatService videoChatService, INotificationService notificationContext, IHubContext <NotificationHub> notificationHubContext)
 {
     _service                = service;
     _authService            = authService;
     _chatHubService         = chatHubService;
     _profileService         = profileService;
     _videoChatService       = videoChatService;
     _notificationService    = notificationContext;
     _notificationHubContext = notificationHubContext;
 }
        public async Task InvokeAsync(HttpContext context, IUserProfilesService userProfilesService)
        {
            if (context.User.Identity.IsAuthenticated)
            {
                var userProfile = await userProfilesService.GetByUserIdAsync();

                if (userProfile.Record != null)
                {
                    var role = userProfile.Record.IsOrganizer ? "organizer" : "user";
                    context.User.AddIdentity(new ClaimsIdentity(new Claim[] {
                        new Claim(ClaimTypes.Role, role)
                    }));
                }
            }
            await _requestDelegate(context);
        }
 public JsonRpcProfileHandlers(IUserProfilesService service)
 {
     Service = service;
 }
Esempio n. 5
0
 public Profiles()
 {
     InitializeComponent();
     _userProfilesService = DependencyService.Get <IUserProfilesService>();
     Init();
 }
 public JsonRpcProfileHandlers(IUserProfilesService service)
 {
     Service = service;
 }
 public UserProfilesController(IUserProfilesService userProfilesService)
 {
     _userProfilesService = userProfilesService;
 }
Esempio n. 8
0
        public void InitialiseService(IConfigSource source)
        {
            ConfigName = "UserProfilesService";

            // Instantiate the request handler
            IHttpServer Server = MainServer.Instance;

            IConfig config = source.Configs[ConfigName];

            if (config == null)
            {
                m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: UserProfilesService missing from OpenSim.ini");
                return;
            }

            if (!config.GetBoolean("Enabled", false))
            {
                Enabled = false;
                return;
            }

            Enabled = true;

            string serviceDll = config.GetString("LocalServiceModule",
                                                 String.Empty);

            if (serviceDll == String.Empty)
            {
                m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: No LocalServiceModule named in section UserProfilesService");
                return;
            }

            Object[] args = new Object[] { source, ConfigName };
            ServiceModule =
                ServerUtils.LoadPlugin <IUserProfilesService>(serviceDll,
                                                              args);

            if (ServiceModule == null)
            {
                m_log.Error("[LOCAL USERPROFILES SERVICE CONNECTOR]: Can't load user profiles service");
                return;
            }

            Enabled = true;

            JsonRpcProfileHandlers handler = new JsonRpcProfileHandlers(ServiceModule);

            Server.AddJsonRPCHandler("avatarclassifiedsrequest", handler.AvatarClassifiedsRequest);
            Server.AddJsonRPCHandler("classified_update", handler.ClassifiedUpdate);
            Server.AddJsonRPCHandler("classifieds_info_query", handler.ClassifiedInfoRequest);
            Server.AddJsonRPCHandler("classified_delete", handler.ClassifiedDelete);
            Server.AddJsonRPCHandler("avatarpicksrequest", handler.AvatarPicksRequest);
            Server.AddJsonRPCHandler("pickinforequest", handler.PickInfoRequest);
            Server.AddJsonRPCHandler("picks_update", handler.PicksUpdate);
            Server.AddJsonRPCHandler("picks_delete", handler.PicksDelete);
            Server.AddJsonRPCHandler("avatarnotesrequest", handler.AvatarNotesRequest);
            Server.AddJsonRPCHandler("avatar_notes_update", handler.NotesUpdate);
            Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
            Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
            Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
            Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate);
            Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
            Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
            Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
            Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
        }
Esempio n. 9
0
        private void UndeliveredMessage(GridInstantMessage im)
        {
            if (im.dialog != (byte)InstantMessageDialog.MessageFromObject &&
                im.dialog != (byte)InstantMessageDialog.MessageFromAgent &&
                im.dialog != (byte)InstantMessageDialog.GroupNotice &&
                im.dialog != (byte)InstantMessageDialog.GroupInvitation &&
                im.dialog != (byte)InstantMessageDialog.InventoryOffered)
            {
                return;
            }

            if (!m_ForwardOfflineGroupMessages)
            {
                if (im.dialog == (byte)InstantMessageDialog.GroupNotice ||
                    im.dialog == (byte)InstantMessageDialog.GroupInvitation)
                {
                    return;
                }
            }

            string reason  = string.Empty;
            bool   success = m_OfflineIMService.StoreMessage(im, out reason);

            // Let the sender know the message was queued for offline delivery
            if (im.dialog == (byte)InstantMessageDialog.MessageFromAgent)
            {
                IClientAPI client = FindClient(new UUID(im.fromAgentID));
                if (client == null)
                {
                    return;
                }

                client.SendInstantMessage(new GridInstantMessage(
                                              null, new UUID(im.toAgentID),
                                              "System", new UUID(im.fromAgentID),
                                              (byte)InstantMessageDialog.MessageFromAgent,
                                              "User is not logged in. " +
                                              (success ? "Message saved." : "Message not saved: " + reason),
                                              false, new Vector3()));
            }

            // Handle Offline EMail Delivery as well.
            // Look up the receiver's email address.
            var recipientAddress = string.Empty;
            var scene            = m_SceneList.First();
            var imViaEmail       = false;

            if (scene != null)
            {
                IUserProfilesService profileService = scene.UserProfilesService;

                if (profileService == null)
                {
                    m_log.DebugFormat("[OfflineIM.V2]: WARNING cannot resolve Profile Service.");
                    m_log.DebugFormat("[OfflineIM.V2]: Using Account and assuming imviaemail is true.");

                    UserAccount account =
                        scene.UserAccountService.GetUserAccount(
                            scene.RegionInfo.ScopeID, new UUID(im.toAgentID));

                    if (account != null)
                    {
                        recipientAddress = account.Email;
                        imViaEmail       = true;
                    }
                }
                else
                {
                    UserPreferences userPreferences = new UserPreferences();
                    userPreferences.UserId = new UUID(im.toAgentID);
                    string prefsRequestResult = String.Empty;

                    if (profileService.UserPreferencesRequest(ref userPreferences, ref prefsRequestResult) == true)
                    {
                        imViaEmail       = userPreferences.IMViaEmail;
                        recipientAddress = userPreferences.EMail;
                    }
                }
            }

            // If we got an email address, send it that way too
            if (imViaEmail && !string.IsNullOrEmpty(recipientAddress))
            {
                string emailStatus = string.Empty;
                bool   result      = m_OfflineIMService.EmailMessage(im, recipientAddress, out emailStatus);
            }
        }
Esempio n. 10
0
 public UserProfilesController(IUserProfilesService userProfiles)
 {
     _userProfiles = userProfiles;
 }