Goedel.Mesh.Mesh.CreateAccount C# (CSharp) Method

CreateAccount() public method

Create an account with the specified account name and profile.

The profile is validated for consistency and rejected if validation fails.

The new account is registered in the Portal log under AccountName@Domain as the unique identifier. The profile is registered in the mesh under the

public CreateAccount ( string AccountID, SignedProfile Profile ) : bool
AccountID string The requested account name.
Profile SignedProfile A signed Personal Profile.
return bool
        public bool CreateAccount(string AccountID, SignedProfile Profile) {

            // Validate the signed profile
            if (!Profile.Validate()) throw new Throw ("Profile not valid");

            // Create the new account on the portal (fail if already exists)
            var Account = new Account();
            Account.AccountID = AccountID;
            Account.Status = "Open";
            Account.Created = DateTime.Now;
            Account.Modified = Account.Created;
            Account.UserProfileUDF = Profile.Identifier;

            //// Allow accounts to be searched by the profile they link to:
            //var KeyData = new IndexTerm(KeyUserProfile, Account.UniqueID);
            //var KeyDatas = new List<IndexTerm> { KeyData };

            PortalStore.New(Account, Account.PrimaryKey(Account.UniqueID), null);

            // Push the profile out to the Mesh
            MeshStore.New(Profile, Profile.Identifier, null);

            return true;
            }

Usage Example

Exemplo n.º 1
0
        public void MeshStorem() {
            File.Delete(Store);
            File.Delete(Portal);
            Mesh = new Mesh(Service, Store, Portal);
            Mesh.CheckAccount(AccountID);

            var DevProfile = new SignedDeviceProfile(Device1, Device1Description);
            var UserProfile = new PersonalProfile(DevProfile);

            var SignedProfile = UserProfile.Signed;
            Mesh.CreateAccount(UserName, SignedProfile);

            Mesh.GetAccount(UserName);

            var PasswordProfile = new PasswordProfile(true);
            var SignedPasswordProfile = PasswordProfile.Signed;

            SignedProfile = UserProfile.Signed;
            Mesh.AddProfile(SignedPasswordProfile);
            Mesh.UpdateProfile(SignedProfile);





            }
All Usage Examples Of Goedel.Mesh.Mesh::CreateAccount