示例#1
0
 //Constructor
 public MoodleUser(string memberId)
 {
     this.muModel = new UserModel()
     {
         username = memberId
     };
     this.memberModel = new SiteMemberModel()
     {
         MembershipId = memberId
     };
 }
示例#2
0
        //Constructor
        public MoodleUser(SiteMemberModel memberModel)
        {
            this.muModel     = new UserModel();
            this.memberModel = memberModel;

            string password, authenticationMethod;

            password             = "******"; //or "notpresent"; based on Remote Learner's recommendation
            authenticationMethod = "saml";      //set authentication method to saml SSO plugin

            muModel.password     = password;
            muModel.auth         = authenticationMethod;
            muModel.username     = memberModel.MembershipId; //moodle username is set to salt member id
            muModel.idnumber     = memberModel.MembershipId; //the idnumber is set the same as the username, this is required for enrollment
            muModel.firstname    = memberModel.FirstName;
            muModel.lastname     = memberModel.LastName;
            muModel.email        = memberModel.PrimaryEmailKey;
            muModel.customfields = new List <CustomfieldModel>();
            AddCustomFields();
        }