permission::write_permission_p (public)

 permission::write_permission_p -object_id object_id \
    [ -party_id party_id ] [ -creation_user creation_user ]

Defined in packages/acs-tcl/tcl/acs-permissions-procs.tcl

Returns whether a party is allowed to edit an object. The logic is that this party must have either write permission, or it must be the one who created the object.

Switches:
-object_id (required)
The object you want to check write permissions for.
-party_id (optional)
The party to have or not have write permission.
-creation_user (optional)
Optionally specify creation_user directly as an optimization. Otherwise a query will be executed.
Returns:
Boolean value expressing if the user has permission to edit the object
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 permission::require_write_permission permission::require_write_permission (public) permission::write_permission_p permission::write_permission_p permission::require_write_permission->permission::write_permission_p acs_object::get_element acs_object::get_element (public) permission::write_permission_p->acs_object::get_element ad_conn ad_conn (public) permission::write_permission_p->ad_conn permission::permission_p permission::permission_p (public) permission::write_permission_p->permission::permission_p

Testcases:
No testcase defined.
Source code:
    if { $party_id eq "" } {
        set party_id [ad_conn user_id]
    }
    if { $creation_user eq "" } {
        set creation_user [acs_object::get_element -object_id $object_id -element creation_user]
    }
    if { $party_id == $creation_user } {
        return 1
    }
    if { [permission::permission_p -privilege write -object_id $object_id -party_id $party_id] } {
        return 1
    }
    return 0
Generic XQL file:
packages/acs-tcl/tcl/acs-permissions-procs.xql

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

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

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