Midgard sitegroups

Posted on 2007-01-17 15:18:06 EET.


Midgard sitegroups concept is well known since Midgard 1.4 release.
This excellent feature has beed added to Midgard library almost seven years ago but till today no one clarified few important issues. I have been talking with Bergie and Rambo about this and we decided to clarify and fix this once and for all.
However you may expect some issues raised in new Midgard releases, you should not to be worry about them as it will affect only Sitegroup 0 Administrator , well known as Root User.

BTW, I updated midgard sitegroup concept docs and we should definitely use this convention to name Midgard persons:

  • Root user ( Sitegroup 0 user )
  • Administrator ( a person who is an administrator within sitegroups X )
  • User ( any sitegroup X user )


Sitegroup issues which now are clarified:

  • You can change object's sitegroup only when you are in anonymous mode or you are being logged in as Root user. And you can change sitegroup only ( and only ) when objecty is not yet created. In Midgard 1.8 series any attempt to change sitegroup property is silently ignored ( due to PHP&ZEND1 ).In newest Midgard , any attempt to change object's sitegroup will trigger unconditional warning.
  • Administrator and User always manage objects in sitegroup context.
  • Root user always delete, update or create object in sitegroup context. In this case it means that we use object's sitegroup property to determine its sitegroup instead sitegroup of current application. Unlike Midgard1 concept ,it means that being logged as Root user you always update or delete object with particular guid and particular sitegroup.
  • Root user can query objects ( using Query Builder ) and get many objects identified by the same guid but within different sitegroups.


The issues I know for now are:

  • how to handle midgard_object_class::get_object_by_guid($guid) static method in a safe way? Probably we should add second optional argument ( sitegroup identifier ) valid only for Root user.
  • how to handle midgard_replicator::export_by_guid($guid) static method? The solution seems to be tha same as this proposed for get_object_by_guid.


For now , midgard-core tries to be as smart as possible and if one of these methods returns more than one record ( for Root user ) MGD_ERR_SITEGROUP_VIOLATION ( Resource link crosses sitegroup borders ) error is unconditionally thrown.

And as we work on new replication framework , we should be able ( very soon ) to replicate the same object between many sitegroups in one database.

Back

Layout Copyright © 2006 Finnish Teleservice Center Ltd Oy - Site Powered by Midgard CMS