Hi Tarjei,

this should work, but only for articles and topics (other objects will need
extra checks on get_class($par_object)):

function mgd_is_writeable($par_object)
{
   global $midgard;

 if (get_class($par_object) == "MidgardArticle")
   {
    if  ($par_object->author  ==  $midgard->user) return true;
   }

   while ($par_object)
   {
    if (mgd_is_member($par_object->owner)) return true;
    $par_object = mgd_get_topic($par_object->up);
   }

   return false;

}


"Tarjei Huse" wrote in message
> Hi Pascal, IMHO this is a needed function / method.
>
> Would you mind writing a function that could check this in php and put
> it in a bug agains midgard-lib to create such functionality?
>
> I see places I would need this too, but I do not have time to adress the
> issue now.
>
> Tarjei
>
>
>
> On Sat, 2003-09-27 at 16:50, pascal van hecke wrote:
> > Hi,
> >
> > http://www.midgard-project.org/manual/en/part.concepts.users.php
explains
> > how access rights work in Midgard.
> >
> > I do not know of a function however that checks whether the logged in
user
> > has write access to some object (an article or a topic).  The only way I
can
> > see now to do this, is using the mgd_is_member(groupID) iteratively on
the
> > group owner of an article, on the parent topic, on the parent of that
topic,
> > ... and so on until I reach a root topic (a topic that has no parent).
> >
> > Doesn't seem very handy, does anybody know of an other way of working?
> >
> > regards,
> >
> > pascal van hecke




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to