当前位置: 首页>>代码示例>>C#>>正文


C# ModelUser.Create方法代码示例

本文整理汇总了C#中ModelUser.Create方法的典型用法代码示例。如果您正苦于以下问题:C# ModelUser.Create方法的具体用法?C# ModelUser.Create怎么用?C# ModelUser.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelUser的用法示例。


在下文中一共展示了ModelUser.Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupImp

        internal static void SetupImp()
        {
            ModelUser mu = new ModelUser("Everyone");

            if (!mu.Exists)
            {
                mu.PasswordHash = null;
                mu.Enabled = false;
                mu.Create();

                ModelUserRights ur = new ModelUserRights("owner", "Everyone");
                ur.Create();
            }

            Securable s = new Securable(typeof(ApplicationExceptionSecureService).FullName);
            if (!s.Exists)
            {
                // Default configuration - the safe way.
                s.TimeSessionIsIssued = 20;
                s.AllowAnonymousAccess = true;
                s.Enabled = true;
                s.GenerationPasswordLength = 6;
                s.AllowedIPFailures = 10;
                s.IPsMustBePreregistered = false;
                s.IPFailureTimeDenying = 60;
                s.DisableIPFiltering = false;
                s.SessionsPerIPAllowed = 2;
                s.Create();
            }
        }
开发者ID:phaetto,项目名称:services-update,代码行数:30,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs

示例2: CreateObjectFromOwner

        public void CreateObjectFromOwner(ModelUser _ModelUser, Services.Packages.Security.ModelUser _Owner, string SessionToken)
        {
            ModelSession session = ModelUserSecureService.CheckSessionImp(SessionToken);

            //if (!Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_Owner, SessionToken, "Create ModelUserOwning"))
            //	throw new UnauthorizedAccessException("Access Denied");

            _ModelUser.Reload();

            if (!_ModelUser.Exists && !Services.Packages.Security.Security.ModelUserSecureService.CheckAccessImp(_Owner, SessionToken, "Create ModelUserOwning"))
                throw new UnauthorizedAccessException("Access Denied");
            else if (_ModelUser.Exists && !ModelUserSecureService.CheckAccessImp(_ModelUser, SessionToken, "Update"))
                throw new UnauthorizedAccessException("Access Denied");

            _ModelUser.Owner = session.User;
            _ModelUser.Owner = _Owner;
            _ModelUser.Create();
        }
开发者ID:phaetto,项目名称:services-update,代码行数:18,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs

示例3: AddUserImp

        internal static void AddUserImp(string userName, string password, string email, string secretQuestion,
            string secretAnswer, bool enabled, string SessionToken)
        {
            if (String.IsNullOrEmpty(userName) ||
                String.IsNullOrEmpty(password) ||
                String.IsNullOrEmpty(email) ||
                String.IsNullOrEmpty(secretQuestion) ||
                String.IsNullOrEmpty(secretAnswer))
            {
                throw new InvalidOperationException("One of the requested fields is empty.");
            }

            ModelSession session = CheckSessionImp(SessionToken);

            if (CheckUserRightsImp(session.User.Name, "ManageUsers"))
            {
                ModelUser mu = new ModelUser(userName);

                if (mu.Exists)
                    throw new InvalidOperationException("User already exists.");

                mu.PasswordHash = Platform.Runtime.Security.Hash.ComputeHash(password, "SHA512", null);
                mu.Email = email;
                mu.SecretQuestion = secretQuestion;
                mu.SecretAnswer = secretAnswer;
                mu.Enabled = enabled;
                mu.Create();

                return;
            }

            throw new UnauthorizedAccessException("Access Denied");
        }
开发者ID:phaetto,项目名称:services-update,代码行数:33,代码来源:Services.Packages.Log.Security.ApplicationExceptionSecureService.cs

示例4: CreateObject

        public void CreateObject(ModelUser _ModelUser, string SessionToken)
        {
            ModelSession session = ModelUserSecureService.CheckSessionImp(SessionToken);

            if (!ModelUserSecureService.CheckUserRightsImp(session.User.Name, "Create " + typeof(ModelUser).FullName))
                throw new UnauthorizedAccessException("Access Denied");

            _ModelUser.Owner = session.User;
            _ModelUser.Create();
        }
开发者ID:phaetto,项目名称:services-update,代码行数:10,代码来源:Services.Packages.Security.Security.ModelUserSecureService.cs


注:本文中的ModelUser.Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。