webCOMAND

cObject::can_add_variant()

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

Prototype

boolean can_add_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 add a variant to this object, otherwise FALSE.

Example

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

Related

can_edit_variant()