membership_rel::change_state (public)
membership_rel::change_state -rel_id rel_id -state state
Defined in packages/acs-tcl/tcl/membership-rel-procs.tcl
Change the state of a membership relation
- Switches:
- -rel_id (required)
- -state (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- auth_authentication_implementations, ad_proc_change_state_member
Source code: db_transaction { # We need the id of the user that we are changing state for set rel_user_id [get_user_id -rel_id $rel_id] # If user is being undeleted - remove him from the public group acs_user::get -user_id $rel_user_id -array user if { $user(member_state) eq "deleted" && $state eq "approved" } { group::remove_member -group_id [acs_magic_object the_public] -user_id $rel_user_id } set valid_states { "approved" "banned" "rejected" "deleted" "needs approval" "merged" "expired" } if {$state in $valid_states} { db_dml update_state { update membership_rels set member_state = :state where rel_id = :rel_id } if {$state eq "deleted"} { # Add user to public group - see bug 1468 group::add_member -no_perm_check -group_id [acs_magic_object the_public] -user_id $rel_user_id } } # Record who changed the state # This will trigger an update of the acs_objects.modified_date column. # We use this in the ApprovalExpiration feature to make sure that a user isn't # bumped back to needs_approval right after an administrator has approved them, # even if the user doesn't log in the meantime. if { [ns_conn isconnected] } { set user_id [ad_conn user_id] } else { set user_id "" } db_dml update_modifying_user {} } if { $rel_user_id ne "" } { acs_user::flush_cache -user_id $rel_user_id }XQL Not present: PostgreSQL, Oracle Generic XQL file: <fullquery name="membership_rel::change_state.update_modifying_user"> <querytext> update acs_objects set modifying_user = :user_id where object_id = :rel_id </querytext> </fullquery>packages/acs-tcl/tcl/membership-rel-procs.xql