[horde] Re: Using perms

E. Warkentin horde at ew-net.de
Fri Mar 28 08:46:20 PST 2003


Hi!

"Jeroen Huinink" <j.huinink at wanadoo.nl> schrieb im Newsbeitrag
news:b619or$fl6$1 at main.gmane.org...

> First off: I'm not a core team member and I didn't develop any
applications
> from scratch. I submitted some patches to different things that got
> commited, so the value of my comments could be limited.

:-) Well, thats even more than I did until now... I think you could call me
a newbie to horde...

> Where do you store the download list? Is this in a database? Where do you
> store the documents? Do you use the VFS or are you only storing URLs? Does
> every download require you to specify a summary and a changelog?


I'm storing the download list in an index sql table, and I decided not to
store the actual documents in the vfs but only the URLs. And yes, for every
download there a description (maybe i missexplained something there), which
is mandatory.
The changelog and the comments are stored in two other tables, but only if
there really are comments or changelog entries specified by the user. In
both indexed tables I'm referencing the unique id of the download, so I do
not have the problem to store a (possibly) big text block for every
download, even if there is no comment or changelog.

> You are looking at Whups as an example application. I would pick another
one
> as an example, since Whups is one of the most complicated. What I think is
> you could take a better look at Gollem, since this is a file manager you
> might be able to use a lot of the stuff in there.
> How I think this is supposed to work is: there is an AppDriver class. This
> AppDriver would supply you with functions like
> listDownloads, addDownload, changeDownload, etc.

I didnt take a look at gollem until now, but that sounds like I have to
modify the AppDriver class to fit my needs like listing, adding, changing,
removing a download...?

> The actual pages call the functions in this class to retrieve the list.
You
> probably do not need a DownloadFile class or something like that. The
> downloads themselves can be represented as hashes inside an array. This
> array would be what is returned by listDownloads.


What I did until now is writing a page that displays the complete list of
download applying some preferences (if existing) like sort order on
different fields, number of entries to display on each page, etc. (I
excerpted that "paging" code from imp, and modyfied it a bit).

> Since I haven't actually worked with Permissions yet (I'm trying to get a
> grip on this). How I think it works in Whups is that you create
permissions
> through the Perms class. The name of the permission identifies your
object.

I took a look on the Perms API refernce, but found it to be a little bit
cryptic to me...

> No, you didn't. I hope the above info helped.

Yes it did... :-) Now I got a point start from, since had no idea where to
look at or anything...

> An example from whups:
> $perm = &$perms->newPermission('whups:comments:' . $comment_id);

Ok, I got that... that'll create something like a "whups" group with a
"comments" subgroup in the rights tree. But where is that Comment id
there...? Will it be an entry to define rights for in the "comments"
subgroup or will it be an entire subsubgroup?

> As I see it the permission doesn't get added to the object. A permission
> refers to an object. So in order to check permission you use the object id
> to retrieve a permission.

That's the next point... for each download i have to define the rights then?
Should be possible to do something like giving the download a specific group
membership?

This is what i mean: I have a group A with subgroups AA, AB, AC. I thought
it would be the right way to make the download a group member of AB or
whatever.

But as i see now, it would be better to define a new rights hirarchy like
"download:entries:AB" (..), grant specific rights to this hirarchy manually
and then make my download a member of "download:entries:AB" ? Is that what
you meant?

> No, you didn't. I hope the above info helped.

Yes it did :-) Hopefully you cousl be of further assistance...?

Regards,
Eduard Warkentin





More information about the horde mailing list