}
</source>
If you want to control the rights not per instance individually, but for all instances of a meta class at once, the following adaptions are required:
* The ''TARGETTYPERIGHT'' of the rights relation must be MetaMetaClass, because this is the meta class (i.e., the type) of meta classes (which we want to relate to user groups in this case). It's a bit tricky to get the MetaMetaClass using Studio. You'll have to do it using Whobert, fetching and assigning the MetaMetaClass with the following code:** UBIK.Kernel.MetaMetaClass mmc = anyObject.Environment.GetSystemObject(UBIK.Kernel.SystemObjects.METACLASS);** Then assign ''mmc'' to the right target type of the relation:** Relationship relation = anyObject.Environment.UBIKDataFactory().Relation(relationUid);** relation.SetLinkedObject(UBIK.Kernel.SystemStrings.TARGETTYPERIGHT, mmc);** Then save the relation using relation.Save().
* In the code snippet, instead of asking for objects and relation data for ''this'', we have to use ''this.MetaClass'':
** UBIKClassList<RelationalObject> userGroups = this.'''MetaClass'''.RelatesFrom(rightsRelation);