Beispiel #1
0
        public void GetGlobalEnvironment(IScriptModulePlugin plugin, ScriptData data, uint localID, out IWorld world, out IHost host)
        {
            // UUID should be changed to object owner.
            UUID               owner        = data.World.RegionInfo.EstateSettings.EstateOwner;
            SEUser             securityUser = new SEUser(owner, "Name Unassigned");
            SecurityCredential creds        = new SecurityCredential(securityUser, data.World);

            world = new World(data.World, creds);
            host  = new Host(new SOPObject(data.World, localID, creds), data.World, new ExtensionHandler(plugin.Extensions));
        }
Beispiel #2
0
        /// <summary>
        /// Creates the user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="password">The password.</param>
        /// <returns></returns>
        /// <exception cref="UserExistsException"></exception>
        public SEUser CreateUser(SEUser user, string password)
        {
            try
            {
                _loggingService.Info(CommonConstants.PerformanceLoggerName, "JsonFileDataService.CreateUser Starting");
                var user2 = Mapper.Map <JEUser>(user);
                user2.PasswordHash = password.CalculateMd5();

                _users.AddOrUpdate(user.UserName, user2, (s, jeUser) => { throw new UserExistsException(s); });

                SaveUserToFile(_loggingService, _users);

                return(user);
            }
            finally
            {
                _loggingService.Info(CommonConstants.PerformanceLoggerName, "JsonFileDataService.CreateUser Ended");
            }
        }
Beispiel #3
0
        /// <summary>
        /// Metod koj vrsi override na Select od klasata IHierarchicalEnumerable so cel
        /// koj vo zavisnost od vrednosta na atributot _viewPath go polni
        /// numeriranoto mnozestvo IHierarchicalEnumerable so zaglavija (ako _viewPath e prazno)
        /// ili so decata od hierarhijata na konkretniot korisnik (ako _viewPath ima vrednost)
        /// </summary>
        /// <returns>NBOTreeHierarchicalEnumerable</returns>
        public override IHierarchicalEnumerable Select()
        {
            NBOTreeHierarchicalEnumerable result = new NBOTreeHierarchicalEnumerable();

            List <INBOTreeNode> roots = new List <INBOTreeNode>();

            if (_viewPath == "")
            {
                if (_typeName == "WebPage")
                {
                    roots.AddRange(new WebPage().GetRoots(_userId));
                }
                if (_typeName == "User")
                {
                    roots.AddRange(new Broker.DataAccess.User().GetRoots(_userId));
                }

                if (_typeName == "OrdinaryUser")
                {
                    roots.AddRange(new OrdinaryUser().GetRoots(_userId));
                }

                if (_typeName == "SEUser")
                {
                    roots.AddRange(new SEUser().GetRoots(_userId));
                }
            }
            else
            {
                if (_typeName == "WebPage")
                {
                    INBOTreeNode node = new WebPage().GetById(Convert.ToInt32(_viewPath));
                    roots.AddRange(node.GetChildren(_userId));
                }
                if (_typeName == "User")
                {
                    INBOTreeNode node = new Broker.DataAccess.User().GetById(Convert.ToInt32(_viewPath));
                    roots.AddRange(node.GetChildren(_userId));
                }

                if (_typeName == "OrdinaryUser")
                {
                    INBOTreeNode node = new OrdinaryUser().GetById(Convert.ToInt32(_viewPath));
                    roots.AddRange(node.GetChildren(_userId));
                }

                if (_typeName == "SEUser")
                {
                    INBOTreeNode node = new SEUser().GetById(Convert.ToInt32(_viewPath));
                    roots.AddRange(node.GetChildren(_userId));
                }
            }
            if (first)
            {
                foreach (INBOTreeNode node in roots)
                {
                    result.Add(new NBOTreeHierarchyData(node, _userId, _typeName));
                }
            }
            first = false;
            return(result);
        }