group::update (public)

 group::update -group_id group_id [ -array array ] [ dict ]

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

Updates a group.The updated values can be either specified as dict or as array. Valid columns are group_name, join_policy and description. Valid join_policy values are 'open', 'closed', 'needs approval'.

Switches:
-group_id (required)
The ID of the group to update.
-array (optional)
Name of array containing the columns to update.
Parameters:
dict (optional)
dict for columns to update.

Partial Call Graph (max 5 caller/called nodes):
%3 install::xml::action::set-join-policy install::xml::action::set-join-policy (public) group::update group::update install::xml::action::set-join-policy->group::update packages/acs-subsite/www/admin/configure.tcl packages/acs-subsite/ www/admin/configure.tcl packages/acs-subsite/www/admin/configure.tcl->group::update packages/acs-subsite/www/admin/subsite-add.tcl packages/acs-subsite/ www/admin/subsite-add.tcl packages/acs-subsite/www/admin/subsite-add.tcl->group::update db_dml db_dml (public) group::update->db_dml lang::util::convert_to_i18n lang::util::convert_to_i18n (public) group::update->lang::util::convert_to_i18n

Testcases:
No testcase defined.
Source code:

    # Construct clauses for the update statement
    set columns { group_name join_policy description }
    if {[llength $dict] == 0} {
        upvar $array row
        set dict [array get row]
    }
    set set_clauses [list]
    
    foreach {name value} $dict {
        if {$name ni $columns} {
            error "Attribute '$name' isn't valid for groups."
        }
        lappend set_clauses "$name = :$name"
        set $name $value
    }

    if { [llength $set_clauses] == 0 } {
        # No rows to update
        return
    }

    db_dml update_group "
        update groups
        set    [join $set_clauses ,]
        where  group_id = :group_id
    "

    if {[info exists group_name]} {
        set pretty_name [lang::util::convert_to_i18n  -message_key "group_title_${group_id}"  -text "$group_name"]
        db_dml update_object_title {
            update acs_objects
            set title = :pretty_name
            where object_id = :group_id
        }
    }
    acs::group_cache flush -partition_key $group_id info-$group_id-
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: