webCOMAND

cObject::can_edit_variant()

Return TRUE if the current or specified user is authorized to edit a variant for this object, otherwise FALSE.

Prototype

boolean can_edit_variant(User $user = NULL, boolean $force = FALSE)

Parameters

  • user - Optional User to check authorizations for.  If not specified, the current user associated with the repository will be used.
  • force - Optionally set to TRUE to force the user authorization to be reloaded instead of using a potentially cached user authorization.

Return

TRUE if the current or specified user is authorized to edit a variant to this object, otherwise FALSE.

Example

// check to see if the current repo user can edit a variant
$repo = \comand::repo();
$obj = $repo->get_object_by_oid(123);
$can = $obj->can_edit_variant();
echo("User can" . ($can ? "" : "not") . " edit variant.\n");

Related

can_add_variant(), can_delete_variant()