Пример #1
0
        protected override void SetPreferredSubtitle()
        {
            ISubtitleStream subtitleStream = _tsReader as ISubtitleStream;
            ITeletextSource teletextSource = _tsReader as ITeletextSource;

            if (_streamInfoSubtitles == null || (subtitleStream == null && teletextSource == null))
            {
                ServiceRegistration.Get <ILogger>().Debug("SetPreferredSubtitle: no valid subtitles stream.");
                return;
            }

            VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>() ?? new VideoSettings();

            // first try to find a stream by it's exact LCID.
            int             preferredSubtitleLanguage = settings.PreferredSubtitleLanguage;
            IUserManagement userManagement            = ServiceRegistration.Get <IUserManagement>();

            if (userManagement?.CurrentUser != null)
            {
                preferredSubtitleLanguage = 0;
                var cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures);
                if (userManagement.CurrentUser.TryGetAdditionalData(UserDataKeysKnown.KEY_PREFERRED_SUBTITLE_LANGUAGE, 0, out string subLang))
                {
                    int langId = cultures?.FirstOrDefault(c => c.TwoLetterISOLanguageName == subLang)?.LCID ?? 0;
                    if (_streamInfoSubtitles.Any(s => s.LCID == langId))
                    {
                        preferredSubtitleLanguage = langId;
                    }
                }
                if (preferredSubtitleLanguage == 0 && userManagement.CurrentUser.TryGetAdditionalData(UserDataKeysKnown.KEY_PREFERRED_SUBTITLE_LANGUAGE, 1, out string subLang2))
                {
                    int langId = cultures?.FirstOrDefault(c => c.TwoLetterISOLanguageName == subLang2)?.LCID ?? 0;
                    if (_streamInfoSubtitles.Any(s => s.LCID == langId))
                    {
                        preferredSubtitleLanguage = langId;
                    }
                }
                if (preferredSubtitleLanguage == 0)
                {
                    preferredSubtitleLanguage = settings.PreferredSubtitleLanguage;
                }
            }

            StreamInfo streamInfo = _streamInfoSubtitles.FindStream(preferredSubtitleLanguage) ?? _streamInfoSubtitles.FindSimilarStream(settings.PreferredSubtitleStreamName);

            if (streamInfo == null || !settings.EnableDvbSubtitles || !settings.EnableTeletextSubtitles)
            {
                // Tell the renderer it should not render subtitles
                if (_subtitleRenderer != null)
                {
                    _subtitleRenderer.RenderSubtitles = false;
                    ServiceRegistration.Get <ILogger>().Debug("SetPreferredSubtitle: set RenderSubtitles to false.");
                }
            }
            else
            {
                ServiceRegistration.Get <ILogger>().Debug("SetPreferredSubtitle: enable stream for {0}", streamInfo.Name);
                _streamInfoSubtitles.EnableStream(streamInfo.Name);
            }
        }
        public GetDisplayNamesServerConnector(IConfigSource config, IHttpServer server, string configName) :
            base(config, server, configName)
        {
            if (configName != String.Empty)
            {
                m_ConfigName = configName;
            }

            IConfig serverConfig = config.Configs[m_ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section '{0}' in config file", m_ConfigName));
            }

            string umService = serverConfig.GetString("AssetService", String.Empty);

            if (umService == String.Empty)
            {
                throw new Exception("No AssetService in config file");
            }

            Object[] args = new Object[] { config };
            m_UserManagement =
                ServerUtils.LoadPlugin <IUserManagement>(umService, args);

            if (m_UserManagement == null)
            {
                throw new Exception(String.Format("Failed to load UserManagement from {0}; config is {1}", umService, m_ConfigName));
            }

            server.AddStreamHandler(
                new GetDisplayNamesHandler("/CAPS/agents/", m_UserManagement, "GetDisplayNames", null));
        }
Пример #3
0
        protected static void NotifyPlayback(MediaItem mediaItem, int playPercentage)
        {
            ISettingsManager      settingsManager = ServiceRegistration.Get <ISettingsManager>();
            PlayerManagerSettings settings        = settingsManager.Load <PlayerManagerSettings>();
            bool watched = playPercentage >= settings.WatchedPlayPercentage;

            if (watched)
            {
                playPercentage = 100;
            }

            IServerConnectionManager scm = ServiceRegistration.Get <IServerConnectionManager>();
            IContentDirectory        cd  = scm.ContentDirectory;

            // Server will update the PlayCount of MediaAspect in ML, this does not affect loaded items.
            if (cd != null)
            {
                cd.NotifyPlayback(mediaItem.MediaItemId, watched);
            }

            // Update loaded item also, so changes will be visible in GUI without reloading
            if (!mediaItem.UserData.ContainsKey(UserDataKeysKnown.KEY_PLAY_PERCENTAGE))
            {
                mediaItem.UserData.Add(UserDataKeysKnown.KEY_PLAY_PERCENTAGE, "0");
            }
            mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_PERCENTAGE] = playPercentage.ToString();

            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement.IsValidUser)
            {
                userProfileDataManagement.UserProfileDataManagement.SetUserMediaItemData(userProfileDataManagement.CurrentUser.ProfileId, mediaItem.MediaItemId,
                                                                                         UserDataKeysKnown.KEY_PLAY_PERCENTAGE, playPercentage.ToString());
            }

            if (watched)
            {
                // Update loaded item also, so changes will be visible in GUI without reloading
                int currentPlayCount;
                if (MediaItemAspect.TryGetAttribute(mediaItem.Aspects, MediaAspect.ATTR_PLAYCOUNT, 0, out currentPlayCount))
                {
                    MediaItemAspect.SetAttribute(mediaItem.Aspects, MediaAspect.ATTR_PLAYCOUNT, ++currentPlayCount);
                }

                if (!mediaItem.UserData.ContainsKey(UserDataKeysKnown.KEY_PLAY_COUNT))
                {
                    mediaItem.UserData.Add(UserDataKeysKnown.KEY_PLAY_COUNT, "0");
                }
                currentPlayCount = Convert.ToInt32(mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT]);
                currentPlayCount++;
                mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT] = currentPlayCount.ToString();

                if (userProfileDataManagement.IsValidUser)
                {
                    userProfileDataManagement.UserProfileDataManagement.SetUserMediaItemData(userProfileDataManagement.CurrentUser.ProfileId, mediaItem.MediaItemId,
                                                                                             UserDataKeysKnown.KEY_PLAY_COUNT, currentPlayCount.ToString());
                }
            }
            ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, ContentDirectoryMessaging.MediaItemChangeType.Updated);
        }
Пример #4
0
        protected override ViewSpecification NavigateCreateViewSpecification(string systemId, IFileSystemResourceAccessor viewRA)
        {
            IServerConnectionManager serverConnectionManager = ServiceRegistration.Get <IServerConnectionManager>();

            IContentDirectory cd = serverConnectionManager.ContentDirectory;

            if (cd == null)
            {
                return(null);
            }

            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            ResourcePath directoryPath = viewRA.CanonicalLocalResourcePath;
            MediaItem    directoryItem = cd.LoadItemAsync(systemId, directoryPath,
                                                          SystemSharesViewSpecification.DIRECTORY_MIA_ID_ENUMERATION, SystemSharesViewSpecification.EMPTY_ID_ENUMERATION, userProfile).Result;

            if (directoryItem == null)
            {
                return(null);
            }
            return(new MediaLibraryBrowseViewSpecification(viewRA.ResourceName, directoryItem.MediaItemId, systemId,
                                                           directoryPath, _necessaryMIATypeIds, _optionalMIATypeIds));
        }
        protected Guid?GetCurrentUserId()
        {
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            return(userProfileDataManagement != null && userProfileDataManagement.IsValidUser ?
                   userProfileDataManagement.CurrentUser.ProfileId : (Guid?)null);
        }
Пример #6
0
        protected void HandleResumeInfo(IPlayerSlotController psc, MediaItem mediaItem, IResumeState resumeState)
        {
            // We can only handle resume info for valid MediaItemIds that are coming from MediaLibrary, not from local browsing.
            if (mediaItem == null)
            {
                return;
            }
            if (mediaItem.MediaItemId == Guid.Empty)
            {
                return;
            }

            string serialized = ResumeStateBase.Serialize(resumeState);

            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement.IsValidUser)
            {
                userProfileDataManagement.UserProfileDataManagement.SetUserMediaItemData(userProfileDataManagement.CurrentUser.ProfileId, mediaItem.MediaItemId, PlayerContext.KEY_RESUME_STATE, serialized);
            }

            if (!mediaItem.UserData.ContainsKey(PlayerContext.KEY_RESUME_STATE))
            {
                mediaItem.UserData.Add(PlayerContext.KEY_RESUME_STATE, "");
            }
            mediaItem.UserData[PlayerContext.KEY_RESUME_STATE] = serialized;

            int playPercentage = GetPlayPercentage(mediaItem, resumeState);

            NotifyPlayback(mediaItem, playPercentage);
        }
        protected internal override void ReLoadItemsAndSubViewSpecifications(out IList <MediaItem> mediaItems, out IList <ViewSpecification> subViewSpecifications)
        {
            mediaItems            = null;
            subViewSpecifications = new List <ViewSpecification>();
            IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (cd == null)
            {
                return;
            }

            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            try
            {
                MediaItemQuery query = new MediaItemQuery(_necessaryMIATypeIds, _optionalMIATypeIds, _filter)
                {
                    Limit = Consts.MAX_NUM_ITEMS_VISIBLE
                };
                mediaItems = cd.Search(query, true, userProfile, ShowVirtualSetting.ShowVirtualMedia(_necessaryMIATypeIds));
            }
            catch (UPnPRemoteException e)
            {
                ServiceRegistration.Get <ILogger>().Error("SimpleTextSearchViewSpecification.ReLoadItemsAndSubViewSpecifications: Error requesting server", e);
                mediaItems = new List <MediaItem>();
            }
        }
        protected static void FillList(IContentDirectory contentDirectory, Guid[] necessaryMIAs, ItemsList list, MediaItemToListItemAction converterAction)
        {
            MediaItemQuery query = new MediaItemQuery(necessaryMIAs, null)
            {
                Limit           = QUERY_LIMIT, // Last 5 imported items
                SortInformation = new List <SortInformation> {
                    new SortInformation(ImporterAspect.ATTR_DATEADDED, SortDirection.Descending)
                }
            };
            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            var items = contentDirectory.Search(query, false, userProfile, ShowVirtualSetting.ShowVirtualMedia(necessaryMIAs));

            list.Clear();
            foreach (MediaItem mediaItem in items)
            {
                PlayableMediaItem listItem = converterAction(mediaItem);
                listItem.Command = new MethodDelegateCommand(() => PlayItemsModel.CheckQueryPlayAction(listItem.MediaItem));
                list.Add(listItem);
            }
            list.FireChange();
        }
        public override ICollection <FilterValue> GetAvailableValues(IEnumerable <Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter)
        {
            IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (cd == null)
            {
                throw new NotConnectedException("The MediaLibrary is not connected");
            }

            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (!userProfileDataManagement.IsValidUser)
            {
                return(new List <FilterValue>());
            }

            IFilter unwatchedFilter = BooleanCombinationFilter.CombineFilters(BooleanOperator.Or,
                                                                              new EmptyUserDataFilter(userProfileDataManagement.CurrentUser.ProfileId, UserDataKeysKnown.KEY_PLAY_COUNT),
                                                                              new RelationalUserDataFilter(userProfileDataManagement.CurrentUser.ProfileId, UserDataKeysKnown.KEY_PLAY_COUNT, RelationalOperator.EQ, "0"));

            IFilter watchedFilter = new RelationalUserDataFilter(userProfileDataManagement.CurrentUser.ProfileId, UserDataKeysKnown.KEY_PLAY_COUNT, RelationalOperator.GT, "0");

            int numUnwatchedItems = cd.CountMediaItems(necessaryMIATypeIds, BooleanCombinationFilter.CombineFilters(BooleanOperator.And, filter, unwatchedFilter), true, ShowVirtualSetting.ShowVirtualMedia(necessaryMIATypeIds));
            int numWatchedItems   = cd.CountMediaItems(necessaryMIATypeIds, BooleanCombinationFilter.CombineFilters(BooleanOperator.And, filter, watchedFilter), true, ShowVirtualSetting.ShowVirtualMedia(necessaryMIATypeIds));

            return(new List <FilterValue>(new FilterValue[]
            {
                new FilterValue(Consts.RES_VALUE_UNWATCHED, unwatchedFilter, null, numUnwatchedItems, this),
                new FilterValue(Consts.RES_VALUE_WATCHED, watchedFilter, null, numWatchedItems, this),
            }.Where(fv => !fv.NumItems.HasValue || fv.NumItems.Value > 0)));
        }
        public GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement uman)
        {
            Init(config);
            m_UserManagement = uman;
            m_CacheWrapper = new RemoteConnectorCacheWrapper(m_UserManagement);

        }
Пример #11
0
 public RegisterController(
     IUserManagement userManagement,
     ILogger<LoginController> logger)
 {
     this.userManagement = userManagement;
     this.logger = logger;
 }
Пример #12
0
 public AdminController(
     IUserManagement userManagement,
     IProductManagement productManagement)
 {
     this.userManagement = userManagement;
     this.productManagement = productManagement;
 }
Пример #13
0
        public AccountModule(IUserManagement userManagement)
            : base("/account")
        {
            _userManagement = userManagement;

            Get["/login"] = p => View["Login"];
        }
Пример #14
0
 public UserGoalsManagement(
     DefaultContext context,
     IUserManagement userManagement)
 {
     this.context = context;
     this.userManagement = userManagement;
 }
        protected async Task <IList <IChannel> > GetUserChannelList(int maxItems, string userDataKey, bool fillList = false)
        {
            IList <IChannel> userChannels = new List <IChannel>();

            if (!TryInitTvHandler())
            {
                return(userChannels);
            }

            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement == null || !userProfileDataManagement.IsValidUser)
            {
                return(userChannels);
            }

            Guid userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            var  userResult  = await userProfileDataManagement.UserProfileDataManagement.GetUserAdditionalDataListAsync(userProfile, userDataKey, true, SortDirection.Descending);

            if (!userResult.Success)
            {
                return(userChannels);
            }

            IEnumerable <Tuple <int, string> > channelList = userResult.Result;

            //Add favorite channels first
            foreach (int channelId in channelList.Select(c => c.Item1))
            {
                var result = await _tvHandler.ChannelAndGroupInfo.GetChannelAsync(channelId);

                if (result.Success && result.Result.MediaType == _mediaType)
                {
                    userChannels.Add(result.Result);
                }
                if (userChannels.Count >= maxItems)
                {
                    break;
                }
            }

            //Add any remaining channels
            if (fillList && userChannels.Count < maxItems)
            {
                foreach (int channelId in ChannelContext.Instance.Channels.Where(c => c.MediaType == _mediaType).Select(c => c.ChannelId).Except(channelList.Select(c => c.Item1)))
                {
                    var result = await _tvHandler.ChannelAndGroupInfo.GetChannelAsync(channelId);

                    if (result.Success)
                    {
                        userChannels.Add(result.Result);
                    }
                    if (userChannels.Count >= maxItems)
                    {
                        break;
                    }
                }
            }
            return(userChannels);
        }
Пример #16
0
        protected static async Task FillListAsync(IContentDirectory contentDirectory, Guid[] necessaryMIATypeIds, ItemsList list, MediaItemToListItemAction converterAction)
        {
            UserProfile     userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser;
            }

            MediaItemQuery query = new MediaItemQuery(necessaryMIATypeIds, UserHelper.GetUserRestrictionFilter(necessaryMIATypeIds, userProfile))
            {
                Limit           = QUERY_LIMIT, // Last 5 imported items
                SortInformation = new List <ISortInformation> {
                    new AttributeSortInformation(ImporterAspect.ATTR_DATEADDED, SortDirection.Descending)
                }
            };

            bool showVirtual = VirtualMediaHelper.ShowVirtualMedia(necessaryMIATypeIds);

            var items = await contentDirectory.SearchAsync(query, false, userProfile?.ProfileId, showVirtual);

            list.Clear();
            foreach (MediaItem mediaItem in items)
            {
                PlayableMediaItem listItem = converterAction(mediaItem);
                listItem.Command = new MethodDelegateCommand(() => PlayItemsModel.CheckQueryPlayAction(listItem.MediaItem));
                list.Add(listItem);
            }
            list.FireChange();
        }
Пример #17
0
        public void TestEpisodeNumbers()
        {
            Guid[] types =
            {
                MediaAspect.ASPECT_ID,            EpisodeAspect.ASPECT_ID, VideoAspect.ASPECT_ID, ImporterAspect.ASPECT_ID,
                ProviderResourceAspect.ASPECT_ID, ExternalIdentifierAspect.ASPECT_ID
            };

            IContentDirectory contentDirectory = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (contentDirectory == null)
            {
                return;
            }

            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            IList <MediaItem> collectedEpisodeMediaItems = contentDirectory.SearchAsync(new MediaItemQuery(types, null, null), true, userProfile, false).Result;
            List <MediaItem>  watchedEpisodeMediaItems   = collectedEpisodeMediaItems.Where(IsWatched).ToList();

            foreach (MediaItem episodeMediaItem in watchedEpisodeMediaItems)
            {
                List <int> episodeNumbers = GetEpisodeNumbers(episodeMediaItem);
            }
        }
Пример #18
0
        void OnConnectionClosed(IClientAPI obj)
        {
            if (obj.SceneAgent.IsChildAgent)
            {
                return;
            }

            // Let's find out if this is a foreign user or a local user
            IUserManagement uMan = Scene.RequestModuleInterface <IUserManagement>();

//          UserAccount account = Scene.UserAccountService.GetUserAccount(Scene.RegionInfo.ScopeID, obj.AgentId);

            if (uMan != null && uMan.IsLocalGridUser(obj.AgentId))
            {
                // local grid user
                m_UAS.LogoutAgent(obj.AgentId, obj.SessionId);
                return;
            }

            AgentCircuitData aCircuit = ((Scene)(obj.Scene)).AuthenticateHandler.GetAgentCircuitData(obj.CircuitCode);

            if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("HomeURI"))
            {
                string            url      = aCircuit.ServiceURLs["HomeURI"].ToString();
                IUserAgentService security = new UserAgentServiceConnector(url);
                security.LogoutAgent(obj.AgentId, obj.SessionId);
                //m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Sent logout call to UserAgentService @ {0}", url);
            }
            else
            {
                m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: HomeURI not found for agent {0} logout", obj.AgentId);
            }
        }
        protected void OnCompleteMovementToRegion(IClientAPI client, bool arg2)
        {
            //m_log.DebugFormat("[HG INVENTORY ACCESS MODULE]: OnCompleteMovementToRegion of user {0}", client.Name);
            object sp = null;

            if (client.Scene.TryGetScenePresence(client.AgentId, out sp))
            {
                if (sp is ScenePresence)
                {
                    AgentCircuitData aCircuit = ((ScenePresence)sp).Scene.AuthenticateHandler.GetAgentCircuitData(client.AgentId);
                    if (aCircuit != null && (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0)
                    {
                        if (m_RestrictInventoryAccessAbroad)
                        {
                            IUserManagement uMan = m_Scene.RequestModuleInterface <IUserManagement>();
                            if (uMan.IsLocalGridUser(client.AgentId))
                            {
                                ProcessInventoryForComingHome(client);
                            }
                            else
                            {
                                ProcessInventoryForArriving(client);
                            }
                        }
                    }
                }
            }
        }
        public void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
            {
                return;
            }

            if (m_UserManagement == null)
            {
                m_UserManagement  = scene.RequestModuleInterface <IUserManagement>();
                m_OfflineIM       = scene.RequestModuleInterface <IOfflineIMService>();
                m_Messaging       = scene.RequestModuleInterface <IMessageTransferModule>();
                m_ForeignImporter = new ForeignImporter(m_UserManagement);

                if (m_ServiceLocation.Equals("local"))
                {
                    m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement);
                    // Also, if local, create the endpoint for the HGGroupsService
                    new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty,
                                                       scene.RequestModuleInterface <IOfflineIMService>(), scene.RequestModuleInterface <IUserAccountService>());
                }
                else
                {
                    m_LocalGroupsConnector = new GroupsServiceRemoteConnectorModule(m_Config, m_UserManagement);
                }

                m_CacheWrapper = new RemoteConnectorCacheWrapper(m_UserManagement);
            }
        }
Пример #21
0
        public override IEnumerable <MediaItem> GetAllMediaItems()
        {
            IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (cd == null)
            {
                return(new List <MediaItem>());
            }

            MediaItemQuery query = new MediaItemQuery(
                _necessaryMIATypeIds,
                _optionalMIATypeIds,
                new BooleanCombinationFilter(BooleanOperator.And,
                                             new IFilter[]
            {
                new RelationalFilter(ProviderResourceAspect.ATTR_SYSTEM_ID, RelationalOperator.EQ, _systemId),
                new LikeFilter(ProviderResourceAspect.ATTR_RESOURCE_ACCESSOR_PATH, SqlUtils.LikeEscape(_basePath.Serialize(), '\\') + "%", '\\', true)
            }));

            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            return(cd.Search(query, false, userProfile, ShowVirtualSetting.ShowVirtualMedia(_necessaryMIATypeIds)));
        }
        public GroupsServiceRemoteConnectorModule(IConfigSource config, IUserManagement uman)
        {
            Init(config);
            m_UserManagement = uman;
            m_CacheWrapper = new RemoteConnectorCacheWrapper(m_UserManagement);

        }
Пример #23
0
 public AdminPortalResources(SharedDbContext sharedDbContext, ApplicationDbContext appDbContext, ICityStateApiService cityStateApiService, IUserManagement userManagement, IAzureStorageService imageStorageService)
 {
     _sharedDbContext     = sharedDbContext;
     _appDbContext        = appDbContext;
     _cityStateApiService = cityStateApiService;
     _userManagement      = userManagement;
     _imageStorageService = imageStorageService;
 }
Пример #24
0
 public UserController(ICartIManagement cart, IUnitOfWork db, IUserManagement um, IItemInCarts itemInCarts, IProductsManagement productsManagement)
 {
     _productsManagement = productsManagement;
     _itemInCarts        = itemInCarts;
     _cartManagement     = cart;
     _db = db;
     _um = um;
 }
Пример #25
0
        public ServerView()
        {
            InitializeComponent();

            IUserManagement userManagement = Fabric.GetUserManagement();

            current = userManagement.GetProfile();
        }
Пример #26
0
 public TaskController(IUserTaskManagement userTaskManagement, IUserTaskDetailManagement userTaskDetailManagement, IUserManagement userManagement, ICommunicationManagement comManagement, IUserDepartmentManagement userdepartmentManagement)
 {
     this.userTaskManagement       = userTaskManagement;
     this.userTaskDetailManagement = userTaskDetailManagement;
     this.userManagement           = userManagement;
     this.comManagement            = comManagement;
     this.userdepartmentManagement = userdepartmentManagement;
 }
Пример #27
0
		public ForeignImporter(IUserManagement uman)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod ().Name);
			}

            m_UserManagement = uman;
        }
Пример #28
0
        public void CreateNewUserEmptyPassword()
        {
            TiskarnaVosahlo.Autentication.LogIn(MASTER_USERNAME, MASTER_PASSWORD);

            IUserManagement userManagement = TiskarnaVosahlo.UserManagement;

            Assert.That(() => userManagement.CreateNewUser(USERNAME, ""), Throws.TypeOf <UserManagementException>());
        }
        protected internal override void ReLoadItemsAndSubViewSpecifications(out IList <MediaItem> mediaItems, out IList <ViewSpecification> subViewSpecifications)
        {
            mediaItems            = null;
            subViewSpecifications = null;
            IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (cd == null)
            {
                return;
            }

            bool            showVirtual = ShowVirtualSetting.ShowVirtualMedia(_query.NecessaryRequestedMIATypeIDs);
            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            try
            {
                if (MaxNumItems.HasValue)
                {
                    // First request value groups. That is a performance consideration:
                    // If we have many items, we need groups. If we have few items, we don't need the groups but simply do a search.
                    // We request the groups first to make it faster for the many items case. In the case of few items, both groups and items
                    // are requested which doesn't take so long because there are only few items.
                    IList <MLQueryResultGroup> groups = cd.GroupValueGroups(MediaAspect.ATTR_TITLE, null, ProjectionFunction.None,
                                                                            _query.NecessaryRequestedMIATypeIDs, _query.Filter, _onlyOnline, GroupingFunction.FirstCharacter, showVirtual);
                    long numItems = groups.Aggregate <MLQueryResultGroup, long>(0, (current, group) => current + group.NumItemsInGroup);
                    if (numItems > MaxNumItems.Value)
                    { // Group items
                        mediaItems            = new List <MediaItem>(0);
                        subViewSpecifications = new List <ViewSpecification>(groups.Count);
                        foreach (MLQueryResultGroup group in groups)
                        {
                            MediaLibraryQueryViewSpecification subViewSpecification =
                                CreateSubViewSpecification(string.Format("{0}", group.GroupKey), _filterPath, group.AdditionalFilter, null);
                            subViewSpecification.MaxNumItems  = null;
                            subViewSpecification._absNumItems = group.NumItemsInGroup;
                            subViewSpecifications.Add(subViewSpecification);
                        }
                        return;
                    }
                    // Else: No grouping
                }
                // Else: No grouping
                mediaItems            = cd.Search(_query, _onlyOnline, userProfile, showVirtual);
                subViewSpecifications = new List <ViewSpecification>(0);
            }
            catch (UPnPRemoteException e)
            {
                ServiceRegistration.Get <ILogger>().Error("SimpleTextSearchViewSpecification.ReLoadItemsAndSubViewSpecifications: Error requesting server", e);
                mediaItems            = null;
                subViewSpecifications = null;
            }
        }
Пример #30
0
        protected static async Task NotifyPlayback(MediaItem mediaItem, int playPercentage, double playDuration)
        {
            ISettingsManager      settingsManager = ServiceRegistration.Get <ISettingsManager>();
            PlayerManagerSettings settings        = settingsManager.Load <PlayerManagerSettings>();
            bool watched = playPercentage >= settings.WatchedPlayPercentage;

            if (watched && mediaItem.IsLastPart)
            {
                playPercentage = 100;
            }
            else if (watched && !mediaItem.IsLastPart)
            {
                playPercentage = 50;
            }

            IServerConnectionManager scm = ServiceRegistration.Get <IServerConnectionManager>();
            IContentDirectory        cd  = scm.ContentDirectory;

            if (cd != null)
            {
                IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();
                if (userProfileDataManagement.IsValidUser)
                {
                    bool updatePlayDate = (watched || playDuration >= MINIMUM_WATCHED_SEC || playPercentage >= MINIMUM_WATCHED_PERCENT);
                    await cd.NotifyUserPlaybackAsync(userProfileDataManagement.CurrentUser.ProfileId, mediaItem.MediaItemId, playPercentage, updatePlayDate);
                }
                else
                {
                    await cd.NotifyPlaybackAsync(mediaItem.MediaItemId, watched);
                }
            }

            // Update loaded item also, so changes will be visible in GUI without reloading
            if (!mediaItem.UserData.ContainsKey(UserDataKeysKnown.KEY_PLAY_PERCENTAGE))
            {
                mediaItem.UserData.Add(UserDataKeysKnown.KEY_PLAY_PERCENTAGE, "0");
            }
            mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_PERCENTAGE] = UserDataKeysKnown.GetSortablePlayPercentageString(playPercentage);

            if (watched)
            {
                // Update loaded item also, so changes will be visible in GUI without reloading
                int currentPlayCount;
                if (MediaItemAspect.TryGetAttribute(mediaItem.Aspects, MediaAspect.ATTR_PLAYCOUNT, 0, out currentPlayCount))
                {
                    MediaItemAspect.SetAttribute(mediaItem.Aspects, MediaAspect.ATTR_PLAYCOUNT, ++currentPlayCount);
                }

                if (!mediaItem.UserData.ContainsKey(UserDataKeysKnown.KEY_PLAY_COUNT))
                {
                    mediaItem.UserData.Add(UserDataKeysKnown.KEY_PLAY_COUNT, UserDataKeysKnown.GetSortablePlayCountString(0));
                }
                currentPlayCount = Convert.ToInt32(mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT]);
                currentPlayCount++;
                mediaItem.UserData[UserDataKeysKnown.KEY_PLAY_COUNT] = UserDataKeysKnown.GetSortablePlayCountString(currentPlayCount);
            }
            ContentDirectoryMessaging.SendMediaItemChangedMessage(mediaItem, ContentDirectoryMessaging.MediaItemChangeType.Updated);
        }
        public override ICollection <FilterValue> GetAvailableValues(IEnumerable <Guid> necessaryMIATypeIds, IFilter selectAttributeFilter, IFilter filter)
        {
            IContentDirectory cd = ServiceRegistration.Get <IServerConnectionManager>().ContentDirectory;

            if (cd == null)
            {
                throw new NotConnectedException("The MediaLibrary is not connected");
            }

            Guid?           userProfile = null;
            IUserManagement userProfileDataManagement = ServiceRegistration.Get <IUserManagement>();

            if (userProfileDataManagement != null && userProfileDataManagement.IsValidUser)
            {
                userProfile = userProfileDataManagement.CurrentUser.ProfileId;
            }

            IEnumerable <Guid> mias    = _necessaryMIATypeIds ?? necessaryMIATypeIds;
            IEnumerable <Guid> optMias = _optionalMIATypeIds != null?_optionalMIATypeIds.Except(mias) : null;

            bool    showVirtual = ShowVirtualSetting.ShowVirtualMedia(necessaryMIATypeIds);
            IFilter queryFilter = new FilteredRelationshipFilter(_role, _linkedRole, filter);

            MediaItemQuery query = new MediaItemQuery(mias, optMias, queryFilter);

            if (_sortInformation != null)
            {
                query.SortInformation = new List <SortInformation> {
                    _sortInformation
                }
            }
            ;

            IList <MediaItem>   items  = cd.Search(query, true, userProfile, showVirtual);
            IList <FilterValue> result = new List <FilterValue>(items.Count);

            foreach (MediaItem item in items)
            {
                string name;
                MediaItemAspect.TryGetAttribute(item.Aspects, MediaAspect.ATTR_TITLE, out name);
                result.Add(new FilterValue(name,
                                           new FilterTreePath(_role),
                                           null,
                                           item,
                                           this));
            }

            //ToDo: Add support for an empty entry for all filtered items that don't have this relationship
            //The below works OK in simple cases but results in an extra, relatively long running query. Maybe this should be handled
            //at the server for all relationship queries...
            //IFilter emptyRelationshipFilter = new NotFilter(new RelationshipFilter(_linkedRole, _role, Guid.Empty));
            //queryFilter = filter != null ? BooleanCombinationFilter.CombineFilters(BooleanOperator.And, filter, emptyRelationshipFilter) : emptyRelationshipFilter;
            //int numEmptyEntries = cd.CountMediaItems(necessaryMIATypeIds, queryFilter, true, showVirtual);
            //if(numEmptyEntries > 0)
            //  result.Insert(0, new FilterValue(Consts.RES_VALUE_EMPTY_TITLE, emptyRelationshipFilter, null, this));

            return(result);
        }
Пример #32
0
        public ForeignImporter(IUserManagement uman)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            m_UserManagement = uman;
        }
Пример #33
0
        /// <summary>
        /// Registers known channel groups so it can be used to restrict users.
        /// </summary>
        /// <param name="channelGroups"></param>
        private void RegisterRestrictions(IList <IChannelGroup> channelGroups)
        {
            IUserManagement userManagement = ServiceRegistration.Get <IUserManagement>();

            foreach (IUserRestriction channelGroup in channelGroups.OfType <IUserRestriction>())
            {
                userManagement.RegisterRestrictionGroup(channelGroup.RestrictionGroup);
            }
        }
 public BusinessManager(IDataAccess dataAccess, IUserManagement userManagement, IAuthenticationManagement authenticationManagement,
     IValidationHelper validationHelper, IRoleManagement roleManagement)//,IModelFactory modelFactory)
 {
     _dataAccess = dataAccess;
     _userManagement = userManagement;
     _authenticationManagement = authenticationManagement;
     _roleManagement = roleManagement;
     _validationHelper = validationHelper;
 }
Пример #35
0
        public void DeleteUser()
        {
            TiskarnaVosahlo.Autentication.LogIn(MASTER_USERNAME, MASTER_PASSWORD);

            IUserManagement userManagement = TiskarnaVosahlo.UserManagement;
            IUser           newUser        = userManagement.CreateNewUser(USERNAME, PASSWORD);

            userManagement.DeleteUser(newUser);
        }
 public UserManagementViewModel(
     IWindowHelper windowHelper,
     IMediator mediator,
     IUserManagement userManager)
 {
     _windowHelper = windowHelper;
     _mediator     = mediator;
     _userManager  = userManager;
 }
Пример #37
0
        public static async Task <bool> NotifyUsage(this IUserManagement userManagement, string scope, string usedItem)
        {
            if (userManagement == null || userManagement.UserProfileDataManagement == null || !userManagement.IsValidUser)
            {
                return(false);
            }

            return(await userManagement.UserProfileDataManagement.NotifyFeatureUsageAsync(userManagement.CurrentUser.ProfileId, scope, usedItem));
        }
Пример #38
0
 public ChildManager(
     IMiddleManagement MiddleManagement,
     IUserSession UserSession,
     IUserManagement UserManagement,
     IChildRepository ChildRepository,
     ITransactionRepository TransactionRepository)
 {
     middleManagement = MiddleManagement;
     userSession = UserSession;
     userManagement = UserManagement;
     childRepository = ChildRepository;
     transactionRepository = TransactionRepository;
 }
Пример #39
0
 public UserController(
     IUserManagement UserManagement,
     IMiddleManagement MiddleManagment,
     IUserSession UserSession,
     IUserAuthentication UserAuthentication,
     IEnumerable<IUserAuthenticator> UserAuthenticators,
     IFormsAuthentication FormsAuthentication,
     IStringHash StringHash)
     : base(MiddleManagment, UserSession, FormsAuthentication)
 {
     userManagement = UserManagement;
     userAuthentication = UserAuthentication;
     userAuthenticators = UserAuthenticators;
     formsAuthentication = FormsAuthentication;
     stringHash = StringHash;
 }
Пример #40
0
        public AuthorizationService(IConfig config, Scene scene)
        {
            m_Scene = scene;
            m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
            m_GridService = scene.GridService;

            if (config != null)
            {
                string accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), String.Empty);
                if (accessStr != string.Empty)
                {
                    try
                    {
                        m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr);
                    }
                    catch (ArgumentException)
                    {
                        m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr);
                    }
                }
                m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue);
            }

        }
Пример #41
0
        public override void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
                return;

            base.RegionLoaded(scene);
            ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface<ISimulatorFeaturesModule>();

            if (featuresModule != null)
                featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest;

            m_UserManagement = m_scene.RequestModuleInterface<IUserManagement>();

        }
Пример #42
0
 public ForeignImporter(IUserManagement uman)
 {
     m_UserManagement = uman;
 }
        public void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
                return;

            if (m_UserManagement == null)
            {
                m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                m_ForeignImporter = new ForeignImporter(m_UserManagement);
            }
        }
Пример #44
0
 public FirstLaunchController(IUserManagement userManagement, IAuthentication authentication, IEnvironment environment)
 {
     _userManagement = userManagement;
     _authentication = authentication;
     _environment = environment;
 }
 public GroupsServiceLocalConnectorModule(IConfigSource config, IUserManagement uman)
 {
     Init(config);
     m_UserManagement = uman;
     m_ForeignImporter = new ForeignImporter(uman);
 }
Пример #46
0
 public void RegionLoaded(Scene scene)
 {
      m_userManager = m_scene.RequestModuleInterface<IUserManagement>();         
      m_primCountModule = m_scene.RequestModuleInterface<IPrimCountModule>();
      m_Dialog = m_scene.RequestModuleInterface<IDialogModule>();
 }
 public RemoteConnectorCacheWrapper(IUserManagement uman)
 {
     m_ForeignImporter = new ForeignImporter(uman);
 }
Пример #48
0
 public ProductManagement(DefaultContext context,
     IUserManagement userManagement)
 {
     this.context = context;
     this.userManagement = userManagement;
 }
Пример #49
0
 public GetDisplayNamesHandler(string path, IUserManagement umService, string name, string description)
     : base("GET", path, name, description)
 {
     m_UserManagement = umService;
 }
        public virtual void RegionLoaded(Scene s)
        {
            if (!m_Enabled)
                return;

            m_UserManager = m_scene.RequestModuleInterface<IUserManagement>();
            m_scene.EventManager.OnRegisterCaps += RegisterCaps;
        }
        public void RegionLoaded(Scene scene)
        {
            if (!m_Enabled)
                return;

            if (m_UserManagement == null)
            {
                m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                m_OfflineIM = scene.RequestModuleInterface<IOfflineIMService>();
                m_Messaging = scene.RequestModuleInterface<IMessageTransferModule>();
                m_ForeignImporter = new ForeignImporter(m_UserManagement);

                if (m_ServiceLocation.Equals("local"))
                {
                    m_LocalGroupsConnector = new GroupsServiceLocalConnectorModule(m_Config, m_UserManagement);
                    // Also, if local, create the endpoint for the HGGroupsService
                    new HGGroupsServiceRobustConnector(m_Config, MainServer.Instance, string.Empty, 
                        scene.RequestModuleInterface<IOfflineIMService>(), scene.RequestModuleInterface<IUserAccountService>());

                }
                else
                    m_LocalGroupsConnector = new GroupsServiceRemoteConnectorModule(m_Config, m_UserManagement);

                m_CacheWrapper = new RemoteConnectorCacheWrapper(m_UserManagement);
            }

        }
Пример #52
0
 public Autentication(IUserManagement userManagement)
 {
     _userManagement = userManagement;
 }
Пример #53
0
        public static void SOPToXml2(XmlTextWriter writer, SceneObjectPart sop, Dictionary<string, object> options)
        {
            writer.WriteStartElement("SceneObjectPart");
            writer.WriteAttributeString("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
            writer.WriteAttributeString("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");

            writer.WriteElementString("AllowedDrop", sop.AllowedDrop.ToString().ToLower());

            WriteUUID(writer, "CreatorID", sop.CreatorID, options);

            if (sop.CreatorData != null && sop.CreatorData != string.Empty)
                writer.WriteElementString("CreatorData", sop.CreatorData);
            else if (options.ContainsKey("home"))
            {
                if (m_UserManagement == null)
                    m_UserManagement = sop.ParentGroup.Scene.RequestModuleInterface<IUserManagement>();
                string name = m_UserManagement.GetUserName(sop.CreatorID);
                writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
            }

            WriteUUID(writer, "FolderID", sop.FolderID, options);
            writer.WriteElementString("InventorySerial", sop.InventorySerial.ToString());

            WriteTaskInventory(writer, sop.TaskInventory, options, sop.ParentGroup.Scene);

            WriteUUID(writer, "UUID", sop.UUID, options);
            writer.WriteElementString("LocalId", sop.LocalId.ToString());
            writer.WriteElementString("Name", sop.Name);
            writer.WriteElementString("Material", sop.Material.ToString());
            writer.WriteElementString("PassTouches", sop.PassTouches.ToString().ToLower());
            writer.WriteElementString("PassCollisions", sop.PassCollisions.ToString().ToLower());
            writer.WriteElementString("RegionHandle", sop.RegionHandle.ToString());
            writer.WriteElementString("ScriptAccessPin", sop.ScriptAccessPin.ToString());

            WriteVector(writer, "GroupPosition", sop.GroupPosition);
            WriteVector(writer, "OffsetPosition", sop.OffsetPosition);

            WriteQuaternion(writer, "RotationOffset", sop.RotationOffset);
            WriteVector(writer, "Velocity", sop.Velocity);
            WriteVector(writer, "AngularVelocity", sop.AngularVelocity);
            WriteVector(writer, "Acceleration", sop.Acceleration);
            writer.WriteElementString("Description", sop.Description);

            writer.WriteStartElement("Color");
            writer.WriteElementString("R", sop.Color.R.ToString(Utils.EnUsCulture));
            writer.WriteElementString("G", sop.Color.G.ToString(Utils.EnUsCulture));
            writer.WriteElementString("B", sop.Color.B.ToString(Utils.EnUsCulture));
            writer.WriteElementString("A", sop.Color.A.ToString(Utils.EnUsCulture));
            writer.WriteEndElement();

            writer.WriteElementString("Text", sop.Text);
            writer.WriteElementString("SitName", sop.SitName);
            writer.WriteElementString("TouchName", sop.TouchName);

            writer.WriteElementString("LinkNum", sop.LinkNum.ToString());
            writer.WriteElementString("ClickAction", sop.ClickAction.ToString());

            WriteShape(writer, sop.Shape, options);

            WriteVector(writer, "Scale", sop.Scale);
            WriteQuaternion(writer, "SitTargetOrientation", sop.SitTargetOrientation); 
            WriteVector(writer, "SitTargetPosition", sop.SitTargetPosition);
            WriteVector(writer, "SitTargetPositionLL", sop.SitTargetPositionLL);
            WriteQuaternion(writer, "SitTargetOrientationLL", sop.SitTargetOrientationLL);
            writer.WriteElementString("ParentID", sop.ParentID.ToString());
            writer.WriteElementString("CreationDate", sop.CreationDate.ToString());
            writer.WriteElementString("Category", sop.Category.ToString());
            writer.WriteElementString("SalePrice", sop.SalePrice.ToString());
            writer.WriteElementString("ObjectSaleType", sop.ObjectSaleType.ToString());
            writer.WriteElementString("OwnershipCost", sop.OwnershipCost.ToString());
            WriteUUID(writer, "GroupID", sop.GroupID, options);

            UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.OwnerID;
            WriteUUID(writer, "OwnerID", ownerID, options);

            UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : sop.LastOwnerID;
            WriteUUID(writer, "LastOwnerID", lastOwnerID, options);

            writer.WriteElementString("BaseMask", sop.BaseMask.ToString());
            writer.WriteElementString("OwnerMask", sop.OwnerMask.ToString());
            writer.WriteElementString("GroupMask", sop.GroupMask.ToString());
            writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString());
            writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
            WriteFlags(writer, "Flags", sop.Flags.ToString(), options);
            WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
            writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
            if (sop.MediaUrl != null)
                writer.WriteElementString("MediaUrl", sop.MediaUrl.ToString());
            WriteBytes(writer, "TextureAnimation", sop.TextureAnimation);
            WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
            writer.WriteElementString("PayPrice0", sop.PayPrice[0].ToString());
            writer.WriteElementString("PayPrice1", sop.PayPrice[1].ToString());
            writer.WriteElementString("PayPrice2", sop.PayPrice[2].ToString());
            writer.WriteElementString("PayPrice3", sop.PayPrice[3].ToString());
            writer.WriteElementString("PayPrice4", sop.PayPrice[4].ToString());

            writer.WriteEndElement();
        }
Пример #54
0
 public IAutentication CreateAutentication(IUserManagement userManagement)
 {
     return new Autentication.Autentication(userManagement);
 }
Пример #55
0
        public static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
        {
            if (tinv.Count > 0) // otherwise skip this
            {
                writer.WriteStartElement("TaskInventory");

                foreach (TaskInventoryItem item in tinv.Values)
                {
                    writer.WriteStartElement("TaskInventoryItem");

                    WriteUUID(writer, "AssetID", item.AssetID, options);
                    writer.WriteElementString("BasePermissions", item.BasePermissions.ToString());
                    writer.WriteElementString("CreationDate", item.CreationDate.ToString());

                    WriteUUID(writer, "CreatorID", item.CreatorID, options);

                    if (item.CreatorData != null && item.CreatorData != string.Empty)
                        writer.WriteElementString("CreatorData", item.CreatorData);
                    else if (options.ContainsKey("home"))
                    {
                        if (m_UserManagement == null)
                            m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                        string name = m_UserManagement.GetUserName(item.CreatorID);
                        writer.WriteElementString("CreatorData", (string)options["home"] + ";" + name);
                    }

                    writer.WriteElementString("Description", item.Description);
                    writer.WriteElementString("EveryonePermissions", item.EveryonePermissions.ToString());
                    writer.WriteElementString("Flags", item.Flags.ToString());
                    WriteUUID(writer, "GroupID", item.GroupID, options);
                    writer.WriteElementString("GroupPermissions", item.GroupPermissions.ToString());
                    writer.WriteElementString("InvType", item.InvType.ToString());
                    WriteUUID(writer, "ItemID", item.ItemID, options);
                    WriteUUID(writer, "OldItemID", item.OldItemID, options);

                    UUID lastOwnerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.LastOwnerID;
                    WriteUUID(writer, "LastOwnerID", lastOwnerID, options);

                    writer.WriteElementString("Name", item.Name);
                    writer.WriteElementString("NextPermissions", item.NextPermissions.ToString());

                    UUID ownerID = options.ContainsKey("wipe-owners") ? UUID.Zero : item.OwnerID;
                    WriteUUID(writer, "OwnerID", ownerID, options);

                    writer.WriteElementString("CurrentPermissions", item.CurrentPermissions.ToString());
                    WriteUUID(writer, "ParentID", item.ParentID, options);
                    WriteUUID(writer, "ParentPartID", item.ParentPartID, options);
                    WriteUUID(writer, "PermsGranter", item.PermsGranter, options);
                    writer.WriteElementString("PermsMask", item.PermsMask.ToString());
                    writer.WriteElementString("Type", item.Type.ToString());
                    writer.WriteElementString("OwnerChanged", item.OwnerChanged.ToString().ToLower());

                    writer.WriteEndElement(); // TaskInventoryItem
                }

                writer.WriteEndElement(); // TaskInventory
            }
        }
        public void RegionLoaded(Scene scene)
        {
//            m_log.DebugFormat("[APPEARANCE INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);

            if (m_scene == null)
                m_scene = scene;

            m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
            m_userManagementModule = m_scene.RequestModuleInterface<IUserManagement>();
            m_presenceService = m_scene.RequestModuleInterface<IPresenceService>();

            if (m_friendsModule != null && m_userManagementModule != null && m_presenceService != null)
            {
                m_scene.AddCommand(
                    "Friends", this, "friends show",
                    "friends show [--cache] <first-name> <last-name>",
                    "Show the friends for the given user if they exist.\n",
                    "The --cache option will show locally cached information for that user.",
                    HandleFriendsShowCommand);
            }
        }
Пример #57
0
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupsEnabled)
                return;

            if (m_debugEnabled) m_log.DebugFormat("[Groups]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            scene.EventManager.OnNewClient += OnNewClient;
            scene.EventManager.OnMakeRootAgent += OnMakeRoot;
            scene.EventManager.OnMakeChildAgent += OnMakeChild;
            scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage;
            // The InstantMessageModule itself doesn't do this, 
            // so lets see if things explode if we don't do it
            // scene.EventManager.OnClientClosed += OnClientClosed;

            if (m_groupData == null)
            {
                m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();

                // No Groups Service Connector, then nothing works...
                if (m_groupData == null)
                {
                    m_groupsEnabled = false;
                    m_log.Error("[Groups]: Could not get IGroupsServicesConnector");
                    RemoveRegion(scene);
                    return;
                }
            }

            if (m_msgTransferModule == null)
            {
                m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

                // No message transfer module, no notices, group invites, rejects, ejects, etc
                if (m_msgTransferModule == null)
                {
                    m_log.Warn("[Groups]: Could not get MessageTransferModule");
                }
            }

            if (m_UserManagement == null)
            {
                m_UserManagement = scene.RequestModuleInterface<IUserManagement>();
                if (m_UserManagement == null)
                    m_log.Warn("[Groups]: Could not get UserManagementModule");
            }

            lock (m_sceneList)
            {
                m_sceneList.Add(scene);
            }


        }
        public void RegionLoaded(Scene scene)
        {
            if (!m_groupMessagingEnabled)
                return;

            if (m_debugEnabled) m_log.DebugFormat("[Groups.Messaging]: {0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);

            m_groupData = scene.RequestModuleInterface<IGroupsServicesConnector>();

            // No groups module, no groups messaging
            if (m_groupData == null)
            {
                m_log.Error("[Groups.Messaging]: Could not get IGroupsServicesConnector, GroupsMessagingModule is now disabled.");
                RemoveRegion(scene); 
                return;
            }

            m_msgTransferModule = scene.RequestModuleInterface<IMessageTransferModule>();

            // No message transfer module, no groups messaging
            if (m_msgTransferModule == null)
            {
                m_log.Error("[Groups.Messaging]: Could not get MessageTransferModule");
                RemoveRegion(scene);
                return;
            }

            m_UserManagement = scene.RequestModuleInterface<IUserManagement>();

            // No groups module, no groups messaging
            if (m_UserManagement == null)
            {
                m_log.Error("[Groups.Messaging]: Could not get IUserManagement, GroupsMessagingModule is now disabled.");
                RemoveRegion(scene);
                return;
            }

            if (m_presenceService == null)
                m_presenceService = scene.PresenceService;
        }