auth::authority::edit (public)

 auth::authority::edit -authority_id authority_id -array array

Defined in packages/acs-authentication/tcl/authority-procs.tcl

Edit info about an authority. Note that there's no checking that the columns you name exist.

Switches:
-authority_id (required)
The authority you want to get.
-array (required)
Name of an array with column values to update.
Author:
Lars Pind <lars@collaboraid.biz>

Partial Call Graph (max 5 caller/called nodes):
%3 test_auth_authority_api auth_authority_api (test acs-authentication) auth::authority::edit auth::authority::edit test_auth_authority_api->auth::authority::edit test_auth_authority_edit auth_authority_edit (test acs-authentication) test_auth_authority_edit->auth::authority::edit auth::authority::get_columns auth::authority::get_columns (private) auth::authority::edit->auth::authority::get_columns auth::authority::get_element auth::authority::get_element (public) auth::authority::edit->auth::authority::get_element auth::authority::get_flush auth::authority::get_flush (private) auth::authority::edit->auth::authority::get_flush auth::authority::get_id_flush auth::authority::get_id_flush (private) auth::authority::edit->auth::authority::get_id_flush db_dml db_dml (public) auth::authority::edit->db_dml auth::authority::create auth::authority::create (public) auth::authority::create->auth::authority::edit auth::local::install auth::local::install (private) auth::local::install->auth::authority::edit auth::local::uninstall auth::local::uninstall (private) auth::local::uninstall->auth::authority::edit packages/acs-admin/www/auth/authority-set-enabled-p.tcl packages/acs-admin/ www/auth/authority-set-enabled-p.tcl packages/acs-admin/www/auth/authority-set-enabled-p.tcl->auth::authority::edit packages/acs-admin/www/auth/authority-set-sort-order.tcl packages/acs-admin/ www/auth/authority-set-sort-order.tcl packages/acs-admin/www/auth/authority-set-sort-order.tcl->auth::authority::edit

Testcases:
auth_authority_api, auth_authority_edit
Source code:
    # We need this to flush the cache later
    set old_short_name [get_element -authority_id $authority_id -element short_name]

    upvar $array row

    set names [array names row]

    # Construct clauses for the update statement
    set set_clauses [list]
    foreach name $names {
        lappend set_clauses "$name = :$name"
    }

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

    set columns [get_columns]

    # Check that the columns provided in the array are all valid
    # Set array entries as local variables
    foreach name $names {
        if {$name ni $columns} {
            error "Attribute '$name' isn't valid for auth_authorities."
        }
        if {$name eq "authority_id"} {
            error "Attribute '$name' is the primary key for auth_authorities, and thus cannot be edited."
        }
        set $name $row($name)
    }

    db_dml update_authority "
        update auth_authorities
        set    [join $set_clauses ""]
        where  authority_id = :authority_id
    "

    get_flush -authority_id $authority_id
    get_id_flush -short_name $old_short_name

    # check if we need to update the object title
    set new_short_name [get_element -authority_id $authority_id -element short_name]
    if {$old_short_name ne $new_short_name } {
        db_dml update_object_title {}
    }
Generic XQL file:
<fullquery name="auth::authority::edit.update_object_title">
    <querytext>
	    update acs_objects
	    set title = :new_short_name
	    where object_id = :authority_id
      </querytext>
</fullquery>
packages/acs-authentication/tcl/authority-procs.xql

PostgreSQL XQL file:
packages/acs-authentication/tcl/authority-procs-postgresql.xql

Oracle XQL file:
packages/acs-authentication/tcl/authority-procs-oracle.xql

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