예제 #1
0
파일: AddUser.cs 프로젝트: erymuzuan/mru
        // Methods
        public bool Execute()
        {
            var domain = Program.CreateAppDomain(ConfigurationFile, TaskAssemblyDirectory);

            var mh = new MembershipHelper
            {
                UserName = UserName,
                Password = Password,
                Email    = Email
            };

            domain.DoCallBack(mh.AddUser);


            foreach (string r in Roles)
            {
                var rh = new RolesHelpher
                {
                    UserName = UserName,
                    Role     = r
                };
                domain.DoCallBack(rh.AddRole);
                domain.DoCallBack(rh.AssignUserToRole);
            }

            AppDomain.Unload(domain);

            return(true);
        }
예제 #2
0
파일: AddUser.cs 프로젝트: ikhwanhayat/mru
        // Methods
        public override bool Execute()
        {
            AppDomain domainSecurityHelper = Program.CreateAppDomain(m_configurationFile, m_taskAssemblyDirectory);

            MembershipHelper mh = new MembershipHelper();

            mh.UserName = m_userName;
            mh.Password = m_password;
            mh.Email    = m_email;

            domainSecurityHelper.DoCallBack(new CrossAppDomainDelegate(mh.AddUser));


            foreach (string r in m_roles)
            {
                RolesHelpher rh = new RolesHelpher();
                rh.UserName = m_userName;
                rh.Role     = r;
                domainSecurityHelper.DoCallBack(new CrossAppDomainDelegate(rh.AddRole));
                domainSecurityHelper.DoCallBack(new CrossAppDomainDelegate(rh.AssignUserToRole));
            }

            AppDomain.Unload(domainSecurityHelper);

            return(true);
        }
예제 #3
0
파일: Program.cs 프로젝트: ikhwanhayat/mru
        static void Main(string[] args)
        {
            string userName, password, email, configurationFile;
            var    roles = new List <string>();

            //
            // create a user with optional role
            if (ParseArguements(args, roles, out userName, out password, out email, out configurationFile))
            {
                AppDomain domainSecurityHelper = CreateAppDomain(configurationFile, null);

                var mh = new MembershipHelper {
                    UserName = userName, Password = password, Email = email
                };

                domainSecurityHelper.DoCallBack(mh.AddUser);


                foreach (string r in roles)
                {
                    var rh = new RolesHelpher {
                        UserName = userName, Role = r
                    };
                    domainSecurityHelper.DoCallBack(rh.AddRole);
                    domainSecurityHelper.DoCallBack(rh.AssignUserToRole);
                }


                AppDomain.Unload(domainSecurityHelper);
                return;
            }

            //  function to add just roles
            roles.Clear();
            if (ParseArguements(args, roles, out configurationFile))
            {
                AppDomain domainSecurityHelper = CreateAppDomain(configurationFile, null);
                foreach (string r in roles)
                {
                    var rh = new RolesHelpher {
                        Role = r
                    };
                    domainSecurityHelper.DoCallBack(rh.AddRole);
                }
                AppDomain.Unload(domainSecurityHelper);
                return;
            }

            Usage();
        }
예제 #4
0
        public override bool Execute()
        {
            AppDomain secDomain = Program.CreateAppDomain(ConfigurationFile, TaskAssemblyDirectory);

            foreach (string r in Roles)
            {
                var rh = new RolesHelpher {
                    Role = r
                };
                secDomain.DoCallBack(rh.AddRole);
            }

            return(true);
        }