예제 #1
0
 private void GetAllPermission(Role role2)
 {
     foreach (Control control in panel1.Controls)
     {
         ModulePermissions setting = control as ModulePermissions;
         if (setting == null)
         {
             continue;
         }
         IList <Permission> permissions = setting.GetAllPermissions();
         foreach (Permission per in permissions)
         {
             role2.Permissions.AddPermission(per);
         }
     }
 }
예제 #2
0
        void InitRight(Role role1, bool eable)
        {
            panel1.Controls.Clear();
            int height = 15;

            //Role role1 = Roles.DefaultRoles.AllPermission;

            foreach (Module module in Modules.GetAllModules())
            {
                IList <Permission> permissions = new List <Permission>();
                for (int i = 0; i < role1.Permissions.Count; i++)
                {
                    permissions.Add(role1.Permissions[i]);
                }
                ModulePermissions modulepermission = new ModulePermissions(module, this.panel1.Width - 30, height, eable, permissions);
                height += modulepermission.Height + 15;
                panel1.Controls.Add(modulepermission);
            }
            Label templabel = new Label();

            templabel.Location = new Point(15, height);
            panel1.Controls.Add(templabel);
        }
예제 #3
0
        private void InitBasicPermission(User user, bool eable)
        {
            panel1.Controls.Clear();
            int height = 15;

            //Role role1 = Roles.DefaultRoles.AllPermission;

            foreach (Module module in Modules.GetAllModules())
            {
                IList <Permission> permissions = new List <Permission>();
                if (user != null)
                {
                    permissions = user.GetPermissionByModule(module);
                }
                ModulePermissions modulepermission = new ModulePermissions(module, this.panel1.Width - 30, height, eable, permissions);
                height += modulepermission.Height + 15;
                panel1.Controls.Add(modulepermission);
            }
            Label templabel = new Label();

            templabel.Location = new Point(15, height);
            panel1.Controls.Add(templabel);
        }