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

Collapse
Posted by Peter Marklund on
I like the min() approach. Here is what I would do:

set context_root_id [db_string select_context_root_id {
    select acs.magic_object_id('default_context') from dual
}]

set admin_user_id [db_string select_admin_user_id {
    select min(user_id)
    from users
    where acs_permission.permission_p(:context_root_id, user_id, 'admin') = 't'
}]

Collapse
Posted by Jeff Davis on
I would argue for making the "system owner" an entry
in acs_magic_objects, but if that seems appalling and you
prefer Peter's method you should probably do it with a
join to the permission view rather than with the permission_p
function (which will force a table scan on users).