Home
The Toolkit for Online Communities
17516 Community Members, 1 member online, 2159 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Q&A : Retrieve object_id of System Owner? : One Message

Forum OpenACS Q&A: Re: Retrieve object_id of System Owner?

Collapse
Posted by Randy O'Meara on
Well, not exactly "ownership", full admin to the creator of the object.

During package installation, the after_install APM callback causes a special administrative instance of the package to be instantiated. Through this instance of the package, common site-wide objects are created and maintained. Objects created here are normally accessible (read-only) to every other instance of the package. Some of these common objects are created during package installation.

Object creation pl/pgsql functions first create an acs_object and then grant admin rights to the creating user. Like so:

	PERFORM acs_permission__grant_permission(
          v_id,
          p_creation_user,
          ''admin''
There must be a creation (grantee) user otherwise the following error is generated.
    ERROR:  ExecInsert: Fail to add null value in not null attribute grantee_id
There is no creation_user at the time that the after_install callback is invoked. Actually, there are no users whatsoever at this time. This acs_permission call is (if I recall) a carryover from the excellent package authoring tutorial and I just carried it along to all of my object creation functions.

I have been looking for an elegant solution but there is none that I can find unless the admin user's id becomes a magic object. Maybe I don't really need to have the acs_permission call at all?