示例#1
0
        public bool AddUser(object user)
        {
            bool     result = false;
            WXafUser permissionPolicyUser = user as WXafUser;

            if (permissionPolicyUser != null)
            {
                Users.Add(permissionPolicyUser);
                result = true;
            }
            return(result);
        }
        static void OnCustomizeRequestProcessors(object sender, CustomizeRequestProcessorsEventArgs e)
        {
            List <IOperationPermission> result   = new List <IOperationPermission>();
            SecurityStrategyComplex     security = (SecurityStrategyComplex)sender;
            WXafUser user = (WXafUser)security.User;

            foreach (WXafRole role in user.Roles)
            {
                foreach (ActionPermission action in role.ActionPermissions)
                {
                    result.Add(new ExecuteActionPermission(action.ActionId));
                }
            }
            IPermissionDictionary dictionary = new PermissionDictionary(result);

            e.Processors.Add(typeof(ExecuteActionPermissionRequest), new ExecuteActionRequestProcessor(dictionary));
        }