group::add_member (public)
group::add_member [ -no_perm_check ] [ -no_automatic_membership_rel ] \ -group_id group_id -user_id user_id [ -rel_type rel_type ] \ [ -member_state member_state ]
Defined in packages/acs-subsite/tcl/group-procs.tcl
Adds a user to a group, checking that the rel_type is permissible given the user's privileges, Can default both the rel_type and the member_state to their relevant values.
- Switches:
- -no_perm_check (optional, boolean)
- avoid permission check
- -no_automatic_membership_rel (optional, boolean)
- Use this flag, when we do not want to add automatically a membership_rel (e.g. in DotLRN)
- -group_id (required)
- group, to which a member should be added
- -user_id (required)
- user, which should be added to a group
- -rel_type (optional)
- relationship type to be used (defaults to membership_rel)
- -member_state (optional)
- state, in which member should be added (gets default via group::default_member_state)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- acs_subsite_expose_bug_1144, acs_subsite_check_composite_group, subsite_api, test_inheritance_and_custom_permissions
Source code: set admin_p [permission::permission_p -object_id $group_id -privilege "admin"] # Only admins can add non-membership_rel members if { $rel_type eq "" || (!$no_perm_check_p && $rel_type ne "" && $rel_type ne "membership_rel" && ![permission::permission_p -object_id $group_id -privilege "admin"]) } { set rel_type "membership_rel" } group::get -group_id $group_id -array group if { !$no_perm_check_p } { set create_p [permission::permission_p -object_id $group_id -privilege "create"] if { $group(join_policy) eq "closed" && !$create_p } { error "You do not have permission to add members to the group '$group(group_name)'" } } else { set create_p 1 } if { $member_state eq "" } { set member_state [group::default_member_state -join_policy $group(join_policy) -create_p $create_p] } if { !$no_automatic_membership_rel_p && $rel_type ne "membership_rel" } { # add them with a membership_rel first relation_add -member_state $member_state "membership_rel" $group_id $user_id } relation_add -member_state $member_state $rel_type $group_id $user_id # # Flush all permission checks pertaining to this user. # permission::cache_flush -party_id $user_id # # Flush members cache for the group # flush_members_cache -group_id $group_idXQL 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