Example #1
0
        private void Init()
        {
            //Create users
            UserTep usr1 = new UserTep(context);

            usr1.Username = "******";
            usr1.Store();

            UserTep usr2 = new UserTep(context);

            usr2.Username = "******";
            usr2.Store();

            UserTep usr3 = new UserTep(context);

            usr3.Username = "******";
            usr3.Store();

            UserTep usr4 = new UserTep(context);

            usr4.Username = "******";
            usr4.Store();

            //create domains
            Domain domain = new Domain(context);

            domain.Identifier = "myDomainTest";
            domain.Kind       = DomainKind.Public;
            domain.Store();

            Domain domain2 = new Domain(context);

            domain2.Identifier = "otherDomainTest";
            domain2.Kind       = DomainKind.Hidden;
            domain2.Store();

            Role role = new Role(context);

            role.Identifier = "member-test";
            role.Store();

            role.IncludePrivilege(Privilege.FromIdentifier(context, "wpsjob-v"));
            role.IncludePrivilege(Privilege.FromIdentifier(context, "wpsjob-s"));

            //Add users in the domain
            role.GrantToUser(usr1, domain);
            role.GrantToUser(usr2, domain);
            role.GrantToUser(usr3, domain);
            role.GrantToUser(usr3, domain2);

            //create community
            ThematicCommunity community1 = new ThematicCommunity(context);

            community1.Identifier = "community-public-1";
            community1.Kind       = DomainKind.Public;
            community1.Store();
            community1.SetOwner(usr3);
        }