Ejemplo n.º 1
0
 public void DeleteApplicationOperation(zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation applicationoperation, bool doNotCallDeleteForThis = false, bool isCascaded = false, object calledBy = null)
 {
     if (applicationoperation == null || applicationoperation.IsTransient())
     {
         return;
     }
     if (applicationoperation.Permissions.Count > 0)
     {
         var cs = new System.Data.ConstraintException("applicationoperation.Permissions elements are restricted and cannot be deleted");
         cs.Data["Entity"]       = "ApplicationOperation";
         cs.Data["PropertyName"] = "Permissions";
         cs.Data["Multiplicity"] = "*";
         throw cs;
     }
     if (!doNotCallDeleteForThis)
     {
         Delete <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>(applicationoperation, isCascaded);
     }
 }
Ejemplo n.º 2
0
 public ManageOperationViewModel()
 {
     ApplicationOperation = new zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation();
 }
        public void ApplicationPermission_persistence_test()
        {
            DateTime now = DateTime.Now;

            // Get datetime without milliseconds
            now = new DateTime(now.Ticks - (now.Ticks % TimeSpan.TicksPerSecond), now.Kind);
            var _applicationsystembo_users_permissions = new zAppDev.DotNet.Framework.Identity.Model.ApplicationUser
            {
                UserName             = "******",
                PasswordHash         = "ApplicationUser_PasswordHash",
                SecurityStamp        = "ApplicationUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 9177,
                Name           = "ApplicationUser_Name",
                Email          = "ApplicationUser_Email",
                PhoneNumber    = "ApplicationUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _applicationsystembo_users_permissions2 = new zAppDev.DotNet.Framework.Identity.Model.ApplicationUser
            {
                UserName             = "******",
                PasswordHash         = "ApplicationUser_PasswordHash",
                SecurityStamp        = "ApplicationUser_SecurityStamp",
                EmailConfirmed       = true,
                LockoutEnabled       = true,
                PhoneNumberConfirmed = true,
                TwoFactorEnabled     = true,
                AccessFailedCount    = 3404,
                Name           = "ApplicationUser_Name",
                Email          = "ApplicationUser_Email",
                PhoneNumber    = "ApplicationUser_PhoneNumber",
                LockoutEndDate = now,
            };
            var _applicationsystembo_roles_permissions = new zAppDev.DotNet.Framework.Identity.Model.ApplicationRole
            {
                Name        = "ApplicationRole_Name",
                Description = "ApplicationRole_Description",
                IsCustom    = true,
            };
            var _applicationsystembo_roles_permissions2 = new zAppDev.DotNet.Framework.Identity.Model.ApplicationRole
            {
                Name        = "ApplicationRole_Name",
                Description = "ApplicationRole_Description",
                IsCustom    = true,
            };
            var _applicationsystembo_operations_permissions = new zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation
            {
                Name = "ApplicationOperation_Name",
                ParentControllerName = "ApplicationOperation_ParentControllerName",
                Type = "ApplicationOperation_Type",
                IsAvailableToAnonymous          = true,
                IsAvailableToAllAuthorizedUsers = true,
            };
            var _applicationsystembo_operations_permissions2 = new zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation
            {
                Name = "ApplicationOperation_Name",
                ParentControllerName = "ApplicationOperation_ParentControllerName",
                Type = "ApplicationOperation_Type",
                IsAvailableToAnonymous          = true,
                IsAvailableToAllAuthorizedUsers = true,
            };

            new PersistenceSpecification <zAppDev.DotNet.Framework.Identity.Model.ApplicationPermission>(Session)
            .CheckProperty(p => p.Name, "ApplicationPermission_Name")
            .CheckProperty(p => p.Description, "ApplicationPermission_Description")
            .CheckProperty(p => p.IsCustom, true)
            .CheckBag(p => p.Users, (new List <zAppDev.DotNet.Framework.Identity.Model.ApplicationUser>
            {
                _applicationsystembo_users_permissions,
                _applicationsystembo_users_permissions2
            }))
            .CheckBag(p => p.Roles, (new List <zAppDev.DotNet.Framework.Identity.Model.ApplicationRole>
            {
                _applicationsystembo_roles_permissions,
                _applicationsystembo_roles_permissions2
            }))
            .CheckBag(p => p.Operations, (new List <zAppDev.DotNet.Framework.Identity.Model.ApplicationOperation>
            {
                _applicationsystembo_operations_permissions,
                _applicationsystembo_operations_permissions2
            }))
            .VerifyTheMappings();
        }