group::member_p (public)

 group::member_p [ -user_id user_id ] [ -group_name group_name ] \
    [ -group_id group_id ] [ -subsite_id subsite_id ] [ -cascade ]

Defined in packages/acs-subsite/tcl/group-procs.tcl

Return 1 if the user is a member of the group specified. You can specify a group name or group id. If there is more than one group with this name, it will use the first one. If cascade is true, check to see if the user is a member of the group by virtue of any other component group. (e.g. if group B is a component of group A then if a user is a member of group B then he is automatically a member of A also.) If cascade is false, then the user must have specifically been granted membership on the group in question.

Switches:
-user_id (optional)
-group_name (optional)
-group_id (optional)
-subsite_id (optional)
Only useful when using group_name. Marks the subsite in which to search for the group_id that belongs to the group_name
-cascade (optional, boolean)
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_check_composite_group acs_subsite_check_composite_group (test acs-subsite) group::member_p group::member_p test_acs_subsite_check_composite_group->group::member_p ad_conn ad_conn (public) group::member_p->ad_conn ad_log ad_log (public) group::member_p->ad_log group::get_id group::get_id (public) group::member_p->group::get_id group::member_p_not_cached group::member_p_not_cached (private) group::member_p->group::member_p_not_cached packages/acs-authentication/lib/local-search.tcl packages/acs-authentication/ lib/local-search.tcl packages/acs-authentication/lib/local-search.tcl->group::member_p packages/acs-subsite/www/group-join.tcl packages/acs-subsite/ www/group-join.tcl packages/acs-subsite/www/group-join.tcl->group::member_p packages/acs-subsite/www/group-leave.tcl packages/acs-subsite/ www/group-leave.tcl packages/acs-subsite/www/group-leave.tcl->group::member_p packages/acs-subsite/www/index.tcl packages/acs-subsite/ www/index.tcl packages/acs-subsite/www/index.tcl->group::member_p packages/acs-subsite/www/members/member-invite.tcl packages/acs-subsite/ www/members/member-invite.tcl packages/acs-subsite/www/members/member-invite.tcl->group::member_p

Testcases:
acs_subsite_check_composite_group
Source code:

    if { $user_id eq "" } {
        set user_id [ad_conn user_id]
    }

    if { $group_name eq "" && $group_id eq "" } {
        ad_log warning "group::member_p: neither group_name nor group_id was provided; returning 0"
        return 0
    }

    if { $group_name ne "" } {
        set group_id [group::get_id -group_name $group_name -subsite_id $subsite_id]
        if { $group_id eq "" } {
            ad_log warning "group::member_p: could not lookup '$group_name' (for subsite_id '$subsite_id'); returning 0"
            return 0
        }
    }

    return [acs::group_cache eval -partition_key $group_id  member-$group_id-$user_id-$cascade_p {
                    group::member_p_not_cached -group_id $group_id -user_id $user_id -cascade_p $cascade_p
                }]
    #return [util_memoize [list group::member_p_not_cached -group_id $group_id -user_id $user_id -cascade_p $cascade_p]]
XQL Not present:
Generic
PostgreSQL XQL file:
packages/acs-subsite/tcl/group-procs-postgresql.xql

Oracle XQL file:
packages/acs-subsite/tcl/group-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: