merge::MergeUserInfo (public)

 merge::MergeUserInfo -from_user_id from_user_id -to_user_id to_user_id

Defined in packages/acs-admin/tcl/merge-procs.tcl

Merge user info. Revokes permissions for from_user_id and grants them to to_user_id.

Switches:
-from_user_id (required)
From user ID.
-to_user_id (required)
To user ID.

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_admin_merge_MergeUserInfo acs_admin_merge_MergeUserInfo (test acs-admin) merge::MergeUserInfo merge::MergeUserInfo test_acs_admin_merge_MergeUserInfo->merge::MergeUserInfo db_0or1row db_0or1row (public) merge::MergeUserInfo->db_0or1row db_dml db_dml (public) merge::MergeUserInfo->db_dml db_foreach db_foreach (public) merge::MergeUserInfo->db_foreach db_string db_string (public) merge::MergeUserInfo->db_string db_transaction db_transaction (public) merge::MergeUserInfo->db_transaction packages/acs-admin/www/users/merge-final.tcl packages/acs-admin/ www/users/merge-final.tcl packages/acs-admin/www/users/merge-final.tcl->merge::MergeUserInfo

Testcases:
acs_admin_merge_MergeUserInfo
Source code:
    ns_log Notice "Running merge::MergeUserInfo"
    db_transaction {
    if { ![db_0or1row to_user_portrait {}] &&  [db_0or1row from_user_portrait {}] } {
        db_dml upd_portrait {}
    }

    # get the permissions of the from_user_id
    # and grant them to the to_user_id
    db_foreach getfromobjs {} {
        # revoke the permissions of from_user_id
        permission::revoke -object_id $from_oid -party_id $from_user_id -privilege $from_priv
        if { ![db_string touserhas {} ] } {
        # grant the permissions to to_user_id
        permission::grant -object_id $from_oid -party_id $to_user_id -privilege $from_priv
        }
    }

    ns_log notice "  Merging acs_objects"

    db_dml acs_objs_upd {}
    }
    ns_log Notice "Finishing merge::MergeUserInfo"
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
<fullquery name="merge::MergeUserInfo.to_user_portrait">
    <querytext>
	select c.item_id
	from acs_rels a, cr_items c
	where a.object_id_two = c.item_id
	and a.object_id_one = :to_user_id
	and a.rel_type = 'user_portrait_rel' 
      </querytext>
</fullquery>

<fullquery name="merge::MergeUserInfo.from_user_portrait">
    <querytext>
	select c.item_id
	from acs_rels a, cr_items c
	where a.object_id_two = c.item_id
	and a.object_id_one = :from_user_id
	and a.rel_type = 'user_portrait_rel' 
      </querytext>
</fullquery>

<fullquery name="merge::MergeUserInfo.upd_portrait">
    <querytext>
	update acs_rels
	set object_id_one = :to_user_id
	where object_id_one = :from_user_id
	and rel_type = 'user_portrait_rel' 
      </querytext>
</fullquery>

<fullquery name="merge::MergeUserInfo.getfromobjs">
    <querytext>
	select object_id as from_oid, privilege as from_priv from acs_permissions where grantee_id = :from_user_id
      </querytext>
</fullquery>

<fullquery name="merge::MergeUserInfo.touserhas">
    <querytext>
	select count(*) from acs_permissions where object_id = :from_oid and grantee_id = :to_user_id	
      </querytext>
</fullquery>

<fullquery name="merge::MergeUserInfo.acs_objs_upd">
    <querytext>
	update acs_objects
	set creation_user = :to_user_id
	where creation_user = :from_user_id 
      </querytext>
</fullquery>
packages/acs-admin/tcl/merge-procs.xql

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