Ejemplo n.º 1
0
        public override OSDArray GetLLSDItems(string[] fields, string[] vals)
        {
            string query = "";

            for (int i = 0; i < fields.Length; i++)
            {
                query += String.Format("where {0} = '{1}' and ", fields[i], vals[i]);
                i++;
            }
            query = query.Remove(query.Length - 5);
            if (fields[0] == "inventoryID")
            {
                IInventoryService invService = m_registry.RequestModuleInterface <IInventoryService>();
                if (invService != null)
                {
                    UUID inventoryID           = UUID.Parse(vals[0]);
                    InventoryItemBase baseItem = new InventoryItemBase(UUID.Parse(vals[0]));
                    if (vals.Count() > 1)
                    {
                        UUID        avatarID   = UUID.Parse(vals[1]);
                        IUserFinder userFinder = m_registry.RequestModuleInterface <IUserFinder>();
                        if (userFinder != null && !userFinder.IsLocalGridUser(avatarID))
                        {
                            string serverURL = userFinder.GetUserServerURL(avatarID, "InventoryServerURI") + "xinventory";
                            XInventoryServicesConnector xinv = new XInventoryServicesConnector(serverURL);
                            return(BuildLLSDInventoryItems(xinv.GetItem(baseItem)));
                        }
                    }
                    return(BuildLLSDInventoryItems(invService.GetItem(baseItem)));
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
 public UserRegisterer(
     IUserWriter writer,
     IUserFinder finder)
 {
     _writer = writer;
     _finder = finder;
 }
Ejemplo n.º 3
0
        public void TestInitialize()
        {
#if DEBUG
            RepositoryTestsHelper.Init();
            _finder = new UserFinder(new PersistenceContext(new PersistenceConfiguration(RepositoryTestsHelper.ConnectionString)));
#endif
        }
Ejemplo n.º 4
0
 public UserService(IOptions <AuthSettings> authSettings, IUserFinder UserFinder,
                    IBaseModuleService BaseService)
 {
     _authSettings = authSettings.Value;
     _userFinder   = UserFinder;
     _baseService  = BaseService;
 }
Ejemplo n.º 5
0
        public override List <string> GetAgentsLocations(string requestor, List <string> userIDs)
        {
            List <string> locations = new List <string> ();

            foreach (string userID in userIDs)
            {
                List <string> l = base.GetAgentsLocations(requestor, new List <string>()
                {
                    userID
                });
                if (l[0] == "NotOnline")
                {
                    UserAccount acc = m_registry.RequestModuleInterface <IUserAccountService> ().GetUserAccount(null, UUID.Parse(userID));
                    if (acc == null)
                    {
                        IUserFinder userFinder = m_registry.RequestModuleInterface <IUserFinder> ();
                        string      url        = "";
                        if (userFinder != null && (url = userFinder.GetUserServerURL(UUID.Parse(userID), GetHandlers.Helpers_IMServerURI)) != "")
                        {
                            l[0] = url;
                        }
                    }
                }
                locations.Add(l[0]);
            }
            return(locations);
        }
Ejemplo n.º 6
0
 public ConversationDTOManager(IConversationManager conversationManager,
                               IMapper mapper,
                               IUserFinder userFinder)
 {
     this.conversationManager = conversationManager;
     this.mapper     = mapper;
     this.userFinder = userFinder;
 }
Ejemplo n.º 7
0
 public UserService(IMapper mapper, IUserUpdator userUpdater, IUserFinder userFinder, IUserCreator userCreator, IJwtCreator jwtCreator)
 {
     _userCreator = userCreator;
     _userFinder  = userFinder;
     _userUpdater = userUpdater;
     _mapper      = mapper;
     _jwtCreator  = jwtCreator;
 }
Ejemplo n.º 8
0
 public ConversationController(IConversationDTOManager conversationDTOManager,
                               IMessageNotifier messageNotifier,
                               IUserFinder userFinder)
 {
     conversationManager  = conversationDTOManager;
     this.messageNotifier = messageNotifier;
     this.userFinder      = userFinder;
 }
Ejemplo n.º 9
0
 public MessageNotifier(IHubContext <MessageHub, IMessageHubClient> hubContext,
                        IConversationDTOManager conversationManager,
                        IUserFinder userFinder)
 {
     this.hubContext          = hubContext;
     this.conversationManager = conversationManager;
     this.userFinder          = userFinder;
 }
Ejemplo n.º 10
0
 public PostController(IUserFinder userFinder,
                       IPostDTOManager postDTOManager,
                       IPostNotifier postNotifier)
 {
     this.userFinder   = userFinder;
     this.postManager  = postDTOManager;
     this.postNotifier = postNotifier;
 }
Ejemplo n.º 11
0
 public CommentController(IUserFinder userFinder,
                          ICommentDTOManager commentDTOManager,
                          IPostNotifier postNotifier)
 {
     this.userFinder        = userFinder;
     this.commentDTOManager = commentDTOManager;
     this.postNotifier      = postNotifier;
 }
Ejemplo n.º 12
0
        public void RequestAvatarProperty(IClientAPI remoteClient, UUID target)
        {
            IUserProfileInfo UPI           = ProfileFrontend.GetUserProfile(target);
            UserAccount      TargetAccount =
                remoteClient.Scene.UserAccountService.GetUserAccount(remoteClient.AllScopeIDs, target);
            IUserFinder userFinder = remoteClient.Scene.RequestModuleInterface <IUserFinder>();

            if (UPI == null || TargetAccount == null)
            {
                if (userFinder == null || userFinder.IsLocalGridUser(target))
                {
                    remoteClient.SendAvatarProperties(target, "",
                                                      Util.ToDateTime(0).ToString("M/d/yyyy", CultureInfo.InvariantCulture),
                                                      new Byte[1], "", 0,
                                                      UUID.Zero, UUID.Zero, "", UUID.Zero);
                    return;
                }
            }
            UserInfo TargetPI =
                remoteClient.Scene.RequestModuleInterface <IAgentInfoService>().GetUserInfo(target.ToString());
            //See if all can see this person
            uint agentOnline = 0;

            if (TargetPI != null && TargetPI.IsOnline && UPI.Visible)
            {
                agentOnline = 16;
            }

            if (IsFriendOfUser(remoteClient.AgentId, target))
            {
                SendProfile(remoteClient, UPI, TargetAccount, agentOnline);
            }
            else
            {
                //Not a friend, so send the first page only and if they are online

                Byte[] charterMember;
                if (UPI.MembershipGroup == "")
                {
                    charterMember = new Byte[1];
                    if (TargetAccount != null)
                    {
                        charterMember[0] = (Byte)((TargetAccount.UserFlags & 0xf00) >> 8);
                    }
                }
                else
                {
                    charterMember = Utils.StringToBytes(UPI.MembershipGroup);
                }
                remoteClient.SendAvatarProperties(UPI.PrincipalID, UPI.AboutText,
                                                  Util.ToDateTime(UPI.Created).ToString("M/d/yyyy",
                                                                                        CultureInfo.InvariantCulture),
                                                  charterMember, UPI.FirstLifeAboutText,
                                                  (uint)(TargetAccount == null ? 0 : TargetAccount.UserFlags & agentOnline),
                                                  UPI.FirstLifeImage, UPI.Image, UPI.WebURL, UPI.Partner);
            }
        }
Ejemplo n.º 13
0
        private bool GetUserProfileData(UUID userID, out Dictionary <string, object> userInfo)
        {
            IUserFinder uManage = m_registry.RequestModuleInterface <IUserFinder>();

            userInfo = new Dictionary <string, object>();

            if (!uManage.IsLocalGridUser(userID))
            {
                // Is Foreign
                string home_url = uManage.GetUserServerURL(userID, "HomeURI");

                if (String.IsNullOrEmpty(home_url))
                {
                    userInfo["user_flags"]   = 0;
                    userInfo["user_created"] = 0;
                    userInfo["user_title"]   = "Unavailable";

                    return(true);
                }

                UserAgentServiceConnector uConn = new UserAgentServiceConnector(home_url);

                Dictionary <string, object> account = uConn.GetUserInfo(userID);

                if (account.Count > 0)
                {
                    if (account.ContainsKey("user_flags"))
                    {
                        userInfo["user_flags"] = account["user_flags"];
                    }
                    else
                    {
                        userInfo["user_flags"] = "";
                    }

                    if (account.ContainsKey("user_created"))
                    {
                        userInfo["user_created"] = account["user_created"];
                    }
                    else
                    {
                        userInfo["user_created"] = "";
                    }

                    userInfo["user_title"] = "HG Visitor";
                }
                else
                {
                    userInfo["user_flags"]   = 0;
                    userInfo["user_created"] = 0;
                    userInfo["user_title"]   = "HG Visitor";
                }
                return(true);
            }
            return(false);
        }
Ejemplo n.º 14
0
 public CommentService(IUnitOfWork uow,
                       ICommentFinder commentFinder,
                       IUserFinder userFinder,
                       ICommentRepository commentRepository)
 {
     _userFinder        = userFinder;
     _commentFinder     = commentFinder;
     _commentRepository = commentRepository;
     _unitOfWork        = uow;
 }
Ejemplo n.º 15
0
 public StoryService(IUnitOfWork uow,
                     IStoryRepositoru storyRepository,
                     IStoryFinder storyFinder,
                     IUserFinder userFinder)
 {
     _storyFinder     = storyFinder;
     _storyRepository = storyRepository;
     _userFinder      = userFinder;
     _unitOfWork      = uow;
 }
Ejemplo n.º 16
0
 public AuthorizationController(
     IUserService userService,
     IMapper mapper, IConfiguration configuration,
     IUserFinder userFinder)
 {
     _userService     = userService;
     _mapper          = mapper;
     _configuration   = configuration;
     this._userFinder = userFinder;
 }
Ejemplo n.º 17
0
 public UserService(IUnitOfWork uow,
                    IUserFinder userFinder,
                    IUserRepositoru userRepositoru,
                    IAuthenticationManager authenticationManager)
 {
     this.authenticationManager = authenticationManager;
     this.userFinder            = userFinder;
     this.userRepositoru        = userRepositoru;
     Database = uow;
 }
Ejemplo n.º 18
0
 public UserService(IUnitOfWork uow,
                    IUserFinder userFinder,
                    IUserRepository userRepository,
                    Interfaces.IAuthenticationManager authenticationManager)
 {
     _authenticationManager = authenticationManager;
     _userFinder            = userFinder;
     _userRepository        = userRepository;
     Database = uow;
 }
Ejemplo n.º 19
0
 public JwtTokenAuthorizationServerMiddleware(
     RequestDelegate next,
     IUserFinder userFinder,
     IOptions <JwtTokenAuthorizationServerOptions> options,
     ILogger <JwtTokenAuthorizationServerMiddleware> logger = null)
 {
     _next       = next;
     _userFinder = userFinder;
     _options    = options.Value;
     _logger     = logger;
 }
Ejemplo n.º 20
0
        public void ConstructorShouldFailWhenUserFinderIsNull()
        {
            // Arrange
            var         mapper     = new Mock <IMapper>().Object;
            IUserFinder userFinder = null;

            // Act
            Action ctor = () => { new GetQueryHandler(mapper, userFinder); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 21
0
        public void ConstructorShouldFailWhenUserFinderIsNull()
        {
            // Arrange
            IUserFinder userFinder       = null;
            var         passwordProvider = new Mock <IPasswordProvider>().Object;

            // Act
            Action ctor = () => { new LoginQueryHandler(userFinder, passwordProvider); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 22
0
 public UserController(SportBetsContext context,
                       IUnitOfWork unitOfWork,
                       IUserFinder userFinder,
                       IRepository <User> repository,
                       IUserService userService)
 {
     _context     = context;
     _unitOfWork  = unitOfWork;
     _userFinder  = userFinder;
     _repository  = repository;
     _userService = userService;
 }
Ejemplo n.º 23
0
 public UpdateCommandHandler(IUserFinder userFinder,
                             IUserRepository userRepository,
                             IVersionProvider versionProvider,
                             IPasswordProvider passwordProvider,
                             IPublishIntegrationEventsService publishIntegrationEventsService
                             )
 {
     _userFinder       = userFinder ?? throw Error.ArgumentNull(nameof(userFinder));
     _userRepository   = userRepository ?? throw Error.ArgumentNull(nameof(userRepository));
     _versionProvider  = versionProvider ?? throw Error.ArgumentNull(nameof(versionProvider));
     _passwordProvider = passwordProvider ?? throw Error.ArgumentNull(nameof(passwordProvider));
     _publishIntegrationEventsService = publishIntegrationEventsService;
 }
        public void AddRegion(IScene scene)
        {
            IConfig hgConfig = scene.Config.Configs["HyperGrid"];

            if (hgConfig == null || !hgConfig.GetBoolean("Enabled", false))
            {
                return;
            }

            m_Scenes.Add(scene);
            m_userFinder = scene.RequestModuleInterface <IUserFinder>();

            scene.EventManager.OnNewClient += EventManager_OnNewClient;
        }
Ejemplo n.º 25
0
 public void FinishedStartup()
 {
     if (m_registry == null)
     {
         return; //Not enabled
     }
     m_CapsService          = m_registry.RequestModuleInterface <ICapsService> ();
     m_GridService          = m_registry.RequestModuleInterface <IGridService> ();
     m_PresenceService      = m_registry.RequestModuleInterface <IAgentInfoService> ();
     m_UserAccountService   = m_registry.RequestModuleInterface <IUserAccountService> ();
     m_UserAgentService     = m_registry.RequestModuleInterface <IUserAgentService>();
     m_SimulationService    = m_registry.RequestModuleInterface <ISimulationService>();
     m_userFinder           = m_registry.RequestModuleInterface <IUserFinder>();
     m_DefaultGatewayRegion = FindDefaultRegion();
 }
Ejemplo n.º 26
0
        public void ConstructorShouldFailWhenUserFinderIsNull()
        {
            // Arrange
            IUserFinder userFinder           = null;
            var         userRepository       = new Mock <IUserRepository>().Object;
            var         versionProvider      = new Mock <IVersionProvider>().Object;
            var         passwordProvider     = new Mock <IPasswordProvider>().Object;
            var         publishEventsService = new Mock <IPublishIntegrationEventsService>().Object;

            // Act
            Action ctor = () => { new UpdateCommandHandler(userFinder, userRepository, versionProvider, passwordProvider, publishEventsService); };

            // Assert
            ctor.Should().Throw <ArgumentNullException>();
        }
Ejemplo n.º 27
0
        /// <summary>
        /// </summary>
        /// <param name = "value">uuid[;endpoint[;name]]</param>
        /// <param name = "uuid"></param>
        /// <param name = "url"></param>
        /// <param name = "firstname"></param>
        /// <param name = "lastname"></param>
        public static bool ParseUniversalUserIdentifier(string value, out UUID uuid, out string url,
                                                        out string firstname, out string lastname, out string secret)
        {
            uuid      = UUID.Zero;
            url       = string.Empty;
            firstname = "Unknown";
            lastname  = "User";
            secret    = string.Empty;

            string[] parts = value.Split(';');
            if (parts.Length >= 1)
            {
                if (!UUID.TryParse(parts[0], out uuid))
                {
                    return(false);
                }
            }

            if (parts.Length >= 2)
            {
                url = parts[1];
            }

            if (parts.Length >= 3)
            {
                string[] name = parts[2].Split();
                if (name.Length == 2)
                {
                    firstname = name[0];
                    lastname  = name[1];
                }
            }
            if (parts.Length >= 4)
            {
                secret = parts[3];
            }

            if (Registry != null && url != "")
            {
                IUserFinder uf = Registry.RequestModuleInterface <IUserFinder>();
                if (uf != null)
                {
                    uf.AddUser(uuid, firstname, lastname, url); //Add to the cache
                }
            }
            return(url != "");
        }
Ejemplo n.º 28
0
 public BugReportController(IBugReportFinder bugReportFinder,
                            IBugReportRater bugReportRater,
                            IMapper mapper,
                            IUserFinder userFinder,
                            ICommentCreator commentCreator,
                            IBugReportCreator bugReportCreator,
                            IPhotoFinder photoFinder
                            )
 {
     this.userFinder       = userFinder;
     this.bugReportFinder  = bugReportFinder;
     this.bugReportRater   = bugReportRater;
     this.bugReportCreator = bugReportCreator;
     this._mapper          = mapper;
     this.commentCreator   = commentCreator;
     this.photoFinder      = photoFinder;
 }
Ejemplo n.º 29
0
        public UserModule(IBaseModuleService baseModuleService, IUserService userService,
                          IUserFinder userFinder) : base("user", baseModuleService, userFinder)
        {
            Post("/login", async ctx =>
            {
                var userDTO = await ctx.Request.Bind <UserDTO>();

                var user = userService.Authenticate(userDTO.Username, userDTO.Password);

                if (user == null)
                {
                    ctx.Response.StatusCode = 400;
                    await ctx.Response.AsJson(new { message = "Username or password is incorrect" });
                    return;
                }

                await baseModuleService.RespondWithEntitiyDTO(ctx, user);
            });
        }
Ejemplo n.º 30
0
        public override List <InventoryItemBase> GetItems(UUID avatarID, string[] fields, string[] vals)
        {
            IUserFinder userFinder = m_registry.RequestModuleInterface <IUserFinder>();

            if (userFinder != null && !userFinder.IsLocalGridUser(avatarID))
            {
                string serverURL = userFinder.GetUserServerURL(avatarID, "InventoryServerURI") + "xinventory";
                UUID   id        = UUID.Parse(vals[0]);
                XInventoryServicesConnector xinv = new XInventoryServicesConnector(serverURL);
                if (fields[0] == "parentFolderID")
                {
                    return(xinv.GetFolderContent(avatarID, id).Items);
                }
                else
                {
                    return(new List <InventoryItemBase> {
                        xinv.GetItem(new InventoryItemBase(id))
                    });
                }
            }
            return(base.GetItems(avatarID, fields, vals));
        }
Ejemplo n.º 31
0
 public void FinishedStartup()
 {
     if (m_registry == null)
         return; //Not enabled
     m_CapsService = m_registry.RequestModuleInterface<ICapsService> ();
     m_GridService = m_registry.RequestModuleInterface<IGridService> ();
     m_PresenceService = m_registry.RequestModuleInterface<IAgentInfoService> ();
     m_UserAccountService = m_registry.RequestModuleInterface<IUserAccountService> ();
     m_UserAgentService = m_registry.RequestModuleInterface<IUserAgentService>();
     m_SimulationService = m_registry.RequestModuleInterface<ISimulationService>();
     m_userFinder = m_registry.RequestModuleInterface<IUserFinder>();
     m_DefaultGatewayRegion = FindDefaultRegion ();
 }
 public ProxyService(IUserFinder userFinder, IUserAuthenticator userAuthenticator)
 {
     this.userFinder = userFinder;
     this.userAuthenticator = userAuthenticator;
 }
Ejemplo n.º 33
0
 public AdminService(IUserFinder finder)
 {
     this.finder = finder;
 }
        public void AddRegion(IScene scene)
        {
            IConfig hgConfig = scene.Config.Configs["HyperGrid"];
            if (hgConfig == null || !hgConfig.GetBoolean ("Enabled", false))
                return;

            m_Scenes.Add(scene);
            m_userFinder = scene.RequestModuleInterface<IUserFinder>();

            scene.EventManager.OnNewClient += EventManager_OnNewClient;
        }