• Publicity: Public Only All

merge-procs.tcl

Definitions of procs for the merge process

Location:
packages/acs-admin/tcl/merge-procs.tcl
Created:
15 APR 2005
Author:
Enrique Catalan <quio@galileo.edu>
CVS Identification:
$Id: merge-procs.tcl,v 1.4.2.1 2019/09/05 13:35:22 antoniop Exp $

Procedures in this file

Detailed information

merge::MergeUserInfo (public)

 merge::MergeUserInfo -from_user_id from_user_id -to_user_id to_user_id

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
[ hide source ] | [ make this the default ]

Content File Source

ad_library {

    Definitions of procs for the merge process

    @creation-date 15 APR 2005
    @author Enrique Catalan (quio@galileo.edu)
    @cvs-id $Id: merge-procs.tcl,v 1.4.2.1 2019/09/05 13:35:22 antoniop Exp $

}

namespace eval merge {}

d_proc -public merge::MergeUserInfo {
    -from_user_id:required
    -to_user_id:required
} {
    Merge user info.  Revokes permissions for from_user_id and grants
    them to to_user_id.

    @param from_user_id From user ID.
    @param to_user_id To user ID.
} {
    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"
}

d_proc -callback merge::MergePackageUser {
    -from_user_id:required
    -to_user_id:required
} {
    Merge two accounts
} -

d_proc -callback merge::MergeShowUserInfo {
    -user_id:required
} {
    Show information of accounts to merge
} -


# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: