Forum OpenACS Q&A: Minor fixes in post-3.2.4 Portals module

Note to users: This fix is based on the most recent CVS repository, and not on the 3.2.4 release!

Before a 3.2.5 release is finalized, you may wish to take note of the following bug fixes in /portals that were missed in the most recent CVS release:

  1. /portals/manage-portal-2.tcl
    This script was overlooked when a similar fix in /portals/admin/manage-portal-2.tcl was applied. The code
    ns_db dml $db "
        delete from portal_table_page_map
        where not ( $select_clause )"
    
    needs to be changed to read
    ns_db dml $db "
        delete from portal_table_page_map
        where page_id in (select ptgm.page_id
                          from portal_table_page_map ptgm
                          where pp.user_id = $user_id and
                          pp.page_id = ptgm.page_id) and
        not ( $select_clause )"
    
    This will fix the symptom where all your previously-defined named portals suddenly disappear when a user creates or modifies his or her own private portal!

  2. /portals/admin/index.tcl
    The code
    # get a list of all authorized administrators
    set admin_list [database_to_tcl_list $db "
        select first_names||' '||last_name as name
        from users
        where ad_group_member_p ( user_id, $group_id ) = 't'"]
    
    needs to be changed to read
    # get a list of all authorized administrators
    set admin_list [database_to_tcl_list $db "
        select first_names||' '||last_name as name
        from users u, user_group_map map
        where ad_group_member_p ( user_id, $group_id ) = 't'
        and u.user_id = map.user_id
        and map.group_id = $group_id
        and map.role in ('administrator', 'all')"]
    

    This will fix the erroneous listing of ALL group members as administrators, in the portal admin pages.

  3. /web/{server}/tcl/portals-defs.tcl
    In the portal_footer proc, similarly, the "administrator_query" needs to be changed to read
    set administrator_query "
        select u.first_names||' '||u.last_name as admin_name,
            u.email as admin_email
        from users u, user_group_map map
        where  u.user_id = map.user_id
        and map.group_id = $id
        and map.role in ('administrator', 'all')"
    

    and the filter in the portal_check_adminstrator_maybe_redirect proc needs to read
    and     role in ('administrator', 'all')"
    

    instead of
    and     role='administrator'
    

    The latter change will fix the symptom where the role "all" is erroneously not applied to grant administrator privileges for the portal in question.

Hopefully this list is complete and correct. Thanks to all who made previous portal fixes! This module is now looking a lot more functional.

Collapse
Posted by Roeland Lengers on
As far as I know, even with this fix you will stell get an error. This is because in manage-portal-2.tcl an alias is used which is not defined. According to me the statement should be:
ns_db dml $db "
        delete from portal_table_page_map
        where page_id in (select ptgm.page_id
                          from portal_table_page_map ptgm,
                               portal_pages pp
                          where pp.user_id = $user_id and
                          pp.page_id = ptgm.page_id)
        and not ( $select_clause )"
You should also upload /web//www/doc/sql/education.sql into the database. This is not done when following the default installation.
Collapse
Posted by Catalin Ivan on
In addition to previous helpful comments ...

- OpenACS 3.2.5 had changes 1 and 3 but not 2

- In item #2 of the original answer there is one more issue with the line:
    where ad_group_member_p ( user_id, $group_id ) = 't'
resulting in
    ERROR:  Column reference "user_id" is ambiguous

I changed to "u.user_id" and it seems ok.

Being a new OpenACS fan I don't realize potential implications, or the possibilities for similar issues in other files. Those with more experience will surely take note :)
Way to go.