示例#1
0
        public override bool IsUserInRole(string username, string screenCode)
        {
            IUserFacade   userFacade   = null;
            ICommonFacade commonFacade = null;

            try
            {
                userFacade   = new UserFacade();
                commonFacade = new CommonFacade();

                int userRole    = userFacade.GetRoleByUser(username);
                int accessRoles = commonFacade.GetRoleValueByScreenCode(screenCode);
                if (accessRoles != 0 && (accessRoles & userRole) == 0)
                {
                    return(false);
                }

                return(true);
            }
            finally
            {
                if (userFacade != null)
                {
                    userFacade.Dispose();
                }
                if (commonFacade != null)
                {
                    commonFacade.Dispose();
                }
            }
        }