예제 #1
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (PermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = (PermissionPolicyRole)ObjectSpace.GetRole("User");

            userRole.CanEditModel = true;
            userRole.AddTypePermissionsRecursively <object>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);

            var user = (PermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);

            if (ObjectSpace.IsNewObject(userRole))
            {
                var permissionData = ObjectSpace.CreateObject <AuditTrailOperationPermissionPolicyPolicyData>();
                permissionData.ObjectTypeData           = typeof(Employee);
                permissionData.ID                       = "audit_emplyee";
                permissionData.AuditTrailMembersContext = "Employee_Members";
                ((XpandPermissionPolicyRole)userRole).Permissions.Add(permissionData);
            }
            ObjectSpace.CommitChanges();
        }
예제 #2
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (XpandPermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");


            var userRole = (XpandPermissionPolicyRole)ObjectSpace.GetRole("User");
            var user     = (XpandPermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);
            userRole.SetTypePermission <XpoStateMachine>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.SetTypePermission <XpoState>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.SetTypePermission <XpoTransition>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.SetTypePermission <PaymentTask>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.SetTypePermission <Status>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);

            CreateStatuses();
            ObjectSpace.CommitChanges();
            CreateStateMachines();
            ObjectSpace.CommitChanges();
        }
예제 #3
0
파일: Updater.cs 프로젝트: xwagner2/eXpand
        private void CreateSecurityObjects()
        {
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            if (ObjectSpace.IsNewObject(defaultRole))
            {
                var adminRole = ObjectSpace.GetAdminRole("Admin");
                var adminUser = (XpandUser)adminRole.GetUser("Admin", ConfigurationManager.AppSettings["AdminDefaultPass"]);
                adminUser.Email = "*****@*****.**";

                var anonymousRole = ObjectSpace.GetAnonymousRole("Anonymous");
                anonymousRole.GetAnonymousUser();

                var userRole  = (XpandRole)ObjectSpace.GetRole("User");
                var typeInfos = XafTypesInfo.Instance.PersistentTypes.Where(info => typeof(DocsBaseObject).IsAssignableFrom(info.Type));
                foreach (var typeInfo in typeInfos)
                {
                    userRole.EnsureTypePermissions(typeInfo.Type, SecurityOperations.ReadOnlyAccess);
                    userRole.Permissions.Add(IOActionPermission());
                    anonymousRole.Permissions.Add(IOActionPermission());
                    anonymousRole.EnsureTypePermissions(typeInfo.Type, SecurityOperations.ReadOnlyAccess);
                    if (typeof(ModuleArtifact).IsAssignableFrom(typeInfo.Type))
                    {
                        userRole.AddMemberAccessPermission(typeInfo.Type, "Text,Author,Url", SecurityOperations.Write, "Creator=CurrentUserId() or Text Is  Null");
                    }
                }
                var user = (SecuritySystemUser)userRole.GetUser("user");
                user.Roles.Add(defaultRole);
            }
        }
예제 #4
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (PermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = (PermissionPolicyRole)ObjectSpace.GetRole("User");
            var user     = (PermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);
            user = (PermissionPolicyUser)userRole.GetUser("user2");
            user.Roles.Add(defaultRole);
            userRole.AddTypePermission <RoleModelObject>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.AddTypePermission <UserModelObject>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);
            userRole.AddTypePermission <ApplicationModelObject>(SecurityOperations.FullAccess, SecurityPermissionState.Allow);


            var modelRole = (PermissionPolicyRole)ObjectSpace.GetDefaultModelRole("ModelRole");

            user.Roles.Add(modelRole);

            ObjectSpace.CommitChanges();
        }
예제 #5
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (PermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");
            var adminUser = adminRole.GetUser("Admin");

            var userRole = (IPermissionPolicyRole)ObjectSpace.GetRole("User");

            userRole.CanEditModel = true;

            var user = (PermissionPolicyUser)((ISecurityRole)userRole).GetUser("user");

            user.Roles.Add(defaultRole);

            if (ObjectSpace.FindObject <Customer>(null) == null)
            {
                var customer = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "Apostolis";
                customer.LastName  = "Bekiaris";
                customer.User      = user;
                customer           = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "FilteredApostolis";
                customer.LastName  = "FilteredBekiaris";
                customer.User      = (PermissionPolicyUser)adminUser;
                var dashboardDefinition = ObjectSpace.CreateObject <DashboardDefinition>();
                dashboardDefinition.Name = "Filtered from model";
                dashboardDefinition.Xml  = GetXML();
            }

            ObjectSpace.CommitChanges();
        }
예제 #6
0
파일: Updater.cs 프로젝트: xwagner2/eXpand
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");
            var adminUser = adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");

            userRole.CanEditModel = true;
            userRole.SetTypePermissionsRecursively <object>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);

            var user = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            if (ObjectSpace.FindObject <Customer>(null) == null)
            {
                var customer = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "Apostolis";
                customer.LastName  = "Bekiaris";
                customer.User      = user;
                customer           = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "FilteredApostolis";
                customer.LastName  = "FilteredBekiaris";
                customer.User      = (SecuritySystemUser)adminUser;
                var dashboardDefinition = ObjectSpace.CreateObject <DashboardDefinition>();
                dashboardDefinition.Name = "Filtered from model";
                dashboardDefinition.Xml  = GetXML();
            }

            ObjectSpace.CommitChanges();
        }
예제 #7
0
파일: Updater.cs 프로젝트: tomimon/eXpand
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            if (ObjectSpace.FindObject <Customer>(null) == null)
            {
                var customer = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "Apostolis";
                customer.LastName  = "Bekiaris";
                customer.Email     = "apostolis.bekiaris at gmail";
                ObjectSpace.CommitChanges();

                customer           = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "Tolis";
                customer.LastName  = "Bek";
                customer.Email     = "apostolis.bekiaris at gmail";

                var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

                var adminRole = ObjectSpace.GetAdminRole("Admin");
                adminRole.GetUser("Admin");

                var userRole = ObjectSpace.GetRole("User");
                var user     = (SecuritySystemUser)userRole.GetUser("user");
                user.Roles.Add(defaultRole);
            }
        }
예제 #8
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();

            if (ObjectSpace.FindObject <XpandPermissionPolicyRole>(null) == null)
            {
                var defaultRole = (XpandPermissionPolicyRole)ObjectSpace.GetDefaultRole();

                var adminRole = ObjectSpace.GetAdminRole("Admin");
                adminRole.GetUser("Admin");

                var userRole = ObjectSpace.GetRole("User");
                var user     = (XpandPermissionPolicyUser)userRole.GetUser("User");
                user.Roles.Add(defaultRole);
                var resourceStream = GetType().Assembly.GetManifestResourceStream(GetType(), "MasterData.xlsx");

                var excelImport     = ObjectSpace.CreateObject <ExcelImport>();
                var excelImportFile = new XpandFileData {
                    Content = resourceStream.ReadFully()
                };
                excelImport.File       = excelImportFile;
                excelImport.Name       = "Import Customers -Genders";
                excelImport.SheetName  = "Active_List";
                excelImport.Type       = typeof(Customer);
                excelImport.HeaderRows = 1;
                excelImport.Map();
            }

            var genderObject = ObjectSpace.CreateObject <GenderObject>();

            genderObject.Gender1 = "Male";
            genderObject         = ObjectSpace.CreateObject <GenderObject>();
            genderObject.Gender1 = "Female";
            ObjectSpace.CommitChanges();
        }
예제 #9
0
파일: Updater.cs 프로젝트: xwagner2/eXpand
        private void CreateSecurityObjects()
        {
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);
        }
예제 #10
0
        private void CreateSecurityObjects()
        {
            var defaultRole = (XpandPermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (XpandPermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);
        }
예제 #11
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);
        }
예제 #12
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            if (ObjectSpace.FindObject <XpandPermissionPolicyRole>(null) == null)
            {
                var defaultRole = (XpandPermissionPolicyRole)ObjectSpace.GetDefaultRole();

                var adminRole = ObjectSpace.GetAdminRole("Admin");
                adminRole.GetUser("Admin");

                var userRole = ObjectSpace.GetRole("User");
                var user     = (XpandPermissionPolicyUser)userRole.GetUser("User");
                user.Roles.Add(defaultRole);
            }
        }
예제 #13
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (XpandPermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (XpandPermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);
            user.Email = "*****@*****.**";
        }
예제 #14
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (PermissionPolicyRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (PermissionPolicyUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            ObjectSpace.CommitChanges();
        }
예제 #15
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");


            var userRole = (XpandRole)ObjectSpace.GetRole("User");

            if (ObjectSpace.IsNewObject(userRole))
            {
                var permissionData = ObjectSpace.CreateObject <StateMachineTransitionOperationPermissionData>();
                permissionData.StateCaption     = "InProgress";
                permissionData.StateMachineName = "Test";
                permissionData.Modifier         = StateMachineTransitionModifier.Deny;
                userRole.Permissions.Add(permissionData);
            }

            userRole.SetTypePermissions <TestTask>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);
            userRole.SetTypePermissions <XpoStateMachine>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);
            userRole.SetTypePermissions <XpoState>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);
            userRole.SetTypePermissions <XpoTransition>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);
            var user = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            var stateMachine = ObjectSpace.FindObject <XpoStateMachine>(CriteriaOperator.Parse("Name=?", "Test")) ??
                               ObjectSpace.CreateObject <XpoStateMachine>();

            stateMachine.Active            = true;
            stateMachine.Name              = "Test";
            stateMachine.TargetObjectType  = typeof(TestTask);
            stateMachine.StatePropertyName = new StringObject("Status");
            stateMachine.StartState        = GetXpoState(TaskStatus.NotStarted, stateMachine);
            foreach (var taskStatus in Enum.GetValues(typeof(TaskStatus)).Cast <TaskStatus>())
            {
                GetXpoState(taskStatus, stateMachine);
            }
            CreateTransition(TaskStatus.NotStarted, TaskStatus.InProgress);
            CreateTransition(TaskStatus.InProgress, TaskStatus.Completed);
            ObjectSpace.FindObject <XpoState>(CriteriaOperator.Parse("Caption=?", TaskStatus.Completed.ToString())).TargetObjectCriteria = IsCurrentUserInRoleOperator.OperatorName + "('Admin')";
            ObjectSpace.CommitChanges();
        }
예제 #16
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (XpandRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");

            adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");
            var user     = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            var modelRole = ObjectSpace.GetDefaultModelRole("ModelRole");

            user.Roles.Add((XpandRole)modelRole);

            ObjectSpace.CommitChanges();
        }
예제 #17
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            if (ObjectSpace.IsNewObject(defaultRole))
            {
                var emailTemplate = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "User activation";
                emailTemplate.Body    = string.Format("A new user @Model.User.UserName has been created. To activate the account please click the following link {0}@Model.User.Activation",
                                                      ((IModelRegistration)
                                                       ((IModelOptionsRegistration)CaptionHelper.ApplicationModel.Options).Registration).ActivationHost + "?ua=");

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "pass forgotten";
                emailTemplate.Body    = "We created a temporary password (@Model.Password) for the UserName (@Model.User.UserName). Please login to reset it";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "New Customer";
                emailTemplate.Body    = "A new customer created with fullname @Model.FullName";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "Project created";
                emailTemplate.Body    = "We created a new project (@Model.Name).";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "TaskStatusChanged";
                emailTemplate.Body    = "The Status of (@Model.Subject) changed to (@Model.Status)";
            }
            var adminRole = ObjectSpace.GetAdminRole("Admin");
            var adminUser = (User)adminRole.GetUser("Admin");

            adminUser.Email = "*****@*****.**";

            var userRole = ObjectSpace.GetRole("User");
            var user     = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            ObjectSpace.CommitChanges();
        }
예제 #18
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (PermissionPolicyRole)ObjectSpace.GetDefaultRole();

            if (ObjectSpace.IsNewObject(defaultRole))
            {
                var emailTemplate = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Configure(EmailTemplateConfig.UserActivation, "http://*****:*****@Model.FullName";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "Project created";
                emailTemplate.Body    = "We created a new project (@Model.Name).";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "TaskStatusChanged";
                emailTemplate.Body    = "The Status of (@Model.Subject) changed to (@Model.Status)";

                emailTemplate         = ObjectSpace.CreateObject <EmailTemplate>();
                emailTemplate.Subject = "email from action";
                emailTemplate.Body    = "Email send for the task with subject (@Model.Subject)";
            }
            var adminRole = ObjectSpace.GetAdminRole("Admin");
            var adminUser = (XpandPermissionPolicyUser)adminRole.GetUser("Admin");

            adminUser.Email = "*****@*****.**";

            var userRole = ObjectSpace.GetRole("User");
            var user     = (PermissionPolicyUser)userRole.GetUser("User");

            user.Roles.Add(defaultRole);

            ObjectSpace.CommitChanges();
        }
예제 #19
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            var defaultRole = (SecuritySystemRole)ObjectSpace.GetDefaultRole();

            var adminRole = ObjectSpace.GetAdminRole("Admin");
            var adminUser = adminRole.GetUser("Admin");

            var userRole = ObjectSpace.GetRole("User");

            userRole.CanEditModel = true;
            userRole.SetTypePermissionsRecursively <object>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow);

            var user = (SecuritySystemUser)userRole.GetUser("user");

            user.Roles.Add(defaultRole);

            if (ObjectSpace.FindObject <Customer>(null) == null)
            {
                var customer = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "Apostolis";
                customer.LastName  = "Bekiaris";
                customer.User      = user;
                customer           = ObjectSpace.CreateObject <Customer>();
                customer.FirstName = "FilteredApostolis";
                customer.LastName  = "FilteredBekiaris";
                customer.User      = (SecuritySystemUser)adminUser;

                using (var stream = GetType().Assembly.GetManifestResourceStream(GetType(), "FilterDashboard.xml")){
                    var dashboardDefinition = ObjectSpace.CreateObject <DashboardDefinition>();
                    dashboardDefinition.Name = "Filtered from model";
                    Debug.Assert(stream != null, "stream != null");
                    dashboardDefinition.Xml = new StreamReader(stream).ReadToEnd();
                }
            }

            ObjectSpace.CommitChanges();
        }
예제 #20
0
파일: Updater.cs 프로젝트: aois-dev/eXpand
        void InitAdminSecurityData()
        {
            var securitySystemRole = ObjectSpace.GetAdminRole("Administrator");

            ObjectSpace.GetUser("Admin", roles: (ISecurityRole)securitySystemRole);
        }
예제 #21
0
        void InitAdminSecurityData()
        {
            var securitySystemRole = ObjectSpace.GetAdminRole("Administrator");

            securitySystemRole.GetUser("Admin");
        }