Example #1
0
        public virtual RoleMenu GetEffectiveMenuPermission(iSystem system, int menuID)
        {
            RoleMenu effectiveRoleMenu = null;

            foreach (UserRole ur in this.GetEffectiveRoles(system))
            {
                foreach (RoleMenu rm in ur.Role.Menus)
                {
                    if (rm.Menu.Id == menuID)
                    {
                        rm.MergeMenuPermissionsTo(ref effectiveRoleMenu);
                    }
                }
            }
            return(effectiveRoleMenu);
        }
Example #2
0
 protected internal virtual void MergeMenuPermissionsTo(ref RoleMenu effectiveRoleMenu)
 {
     if (null == effectiveRoleMenu)
     {
         effectiveRoleMenu = new RoleMenu
         {
             canAddData    = this.canAddData,
             canChangeData = this.canChangeData,
             canDeleteData = this.canDeleteData,
             canDisplay    = this.canDisplay,
             canPrintData  = this.canPrintData,
             menu          = Menu,
         };
     }
     else
     {
         effectiveRoleMenu.canAddData    |= this.canAddData;
         effectiveRoleMenu.canChangeData |= this.canChangeData;
         effectiveRoleMenu.canDeleteData |= this.canDeleteData;
         effectiveRoleMenu.canDisplay    |= this.canDisplay;
         effectiveRoleMenu.canPrintData  |= this.canPrintData;
     }
 }