本文整理汇总了PHP中Ticket::isUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Ticket::isUser方法的具体用法?PHP Ticket::isUser怎么用?PHP Ticket::isUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ticket
的用法示例。
在下文中一共展示了Ticket::isUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canUpdateItem
/**
* Is the current user have right to update the current satisfaction
*
* @return boolean
**/
function canUpdateItem()
{
$ticket = new Ticket();
if (!$ticket->getFromDB($this->fields['tickets_id'])) {
return false;
}
// you can't change if your answer > 12h
if (!is_null($this->fields['date_answered']) && strtotime("now") - strtotime($this->fields['date_answered']) > 12 * HOUR_TIMESTAMP) {
return false;
}
if ($ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) || $ticket->fields["users_id_recipient"] === Session::getLoginUserID() || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::REQUESTER, $_SESSION["glpigroups"])) {
return true;
}
return false;
}
示例2: canUpdateItem
/**
* Is the current user have right to update the current followup ?
*
* @return boolean
**/
function canUpdateItem()
{
if ($this->fields["users_id"] != Session::getLoginUserID() && !Session::haveRight(self::$rightname, self::UPDATEALL)) {
return false;
}
$ticket = new Ticket();
if (!$ticket->can($this->getField('tickets_id'), READ)) {
return false;
}
if ($this->fields["users_id"] === Session::getLoginUserID() && Session::haveRight(self::$rightname, self::UPDATEMY)) {
return true;
}
// Only the technician
return Session::haveRight(self::$rightname, self::UPDATEALL) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
}
示例3: getCentral
//.........这里部分代码省略.........
$values[$predeffield] = $default_values[$predeffield];
}
}
}
}
}
// Put ticket template on $values for actors
$values['_tickettemplate'] = $tt;
$canupdate = Session::haveRight('update_ticket', '1');
$canpriority = Session::haveRight('update_priority', '1');
$canstatus = $canupdate;
if (in_array($ticket->fields['status'], $ticket->getClosedStatusArray())) {
$canupdate = false;
}
$showuserlink = 0;
if (Session::haveRight('user', 'r')) {
$showuserlink = 1;
}
if (!$options['template_preview']) {
$ticket->showTabs($options);
} else {
// Add all values to fields of tickets for template preview
foreach ($values as $key => $val) {
if (!isset($ticket->fields[$key])) {
$ticket->fields[$key] = $val;
}
}
}
// In percent
$colsize1 = '13';
$colsize2 = '29';
$colsize3 = '13';
$colsize4 = '45';
$canupdate_descr = $canupdate || $ticket->fields['status'] == Ticket::INCOMING && $ticket->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID()) && $ticket->numberOfFollowups() == 0 && $ticket->numberOfTasks() == 0;
if (!$options['template_preview']) {
echo "<form method='post' name='form_ticket' enctype='multipart/form-data' action='" . $CFG_GLPI["root_doc"] . "/front/ticket.form.php'>";
}
echo "<div class='spaced' id='tabsbody'>";
echo "<table class='tab_cadre_fixe' id='mainformtable'>";
// Optional line
$ismultientities = Session::isMultiEntitiesMode();
echo "<tr class='headerRow'>";
echo "<th colspan='4'>";
if ($ID) {
$text = sprintf(__('%1$s - %2$s'), $ticket->getTypeName(1), sprintf(__('%1$s: %2$s'), __('ID'), $ID));
if ($ismultientities) {
$text = sprintf(__('%1$s (%2$s)'), $text, Dropdown::getDropdownName('glpi_entities', $ticket->fields['entities_id']));
}
echo $text;
} else {
if ($ismultientities) {
printf(__('The ticket will be added in the entity %s'), Dropdown::getDropdownName("glpi_entities", $ticket->fields['entities_id']));
} else {
_e('New ticket');
}
}
echo "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<th width='{$colsize1}%'>";
echo $tt->getBeginHiddenFieldText('date');
if (!$ID) {
printf(__('%1$s%2$s'), __('Opening date'), $tt->getMandatoryMark('date'));
} else {
_e('Opening date');
}
echo $tt->getEndHiddenFieldText('date');
示例4: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
if (!parent::canReadITILItem()) {
return false;
}
$ticket = new Ticket();
if ($ticket->getFromDB($this->fields['tickets_id'])) {
return Session::haveRight(self::$rightname, self::ADDALLTICKET) || $ticket->isUser(CommonITILActor::ASSIGN, Session::getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(CommonITILActor::ASSIGN, $_SESSION['glpigroups']);
}
return false;
}
示例5: canUpdateItem
/**
* Is the current user have right to update the current followup ?
*
* @return boolean
**/
function canUpdateItem()
{
if ($this->fields["users_id"] != getLoginUserID() && !haveRight('update_followups', 1)) {
return false;
}
$ticket = new Ticket();
if (!$ticket->can($this->getField('tickets_id'), 'r')) {
return false;
}
if ($this->fields["users_id"] === getLoginUserID() && haveRight('update_own_followups', 1)) {
return true;
}
// Only the technician
return haveRight("update_followups", "1") || $ticket->isUser(Ticket::ASSIGN, getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(Ticket::ASSIGN, $_SESSION['glpigroups']);
}
示例6: methodsetTicketAssign
/**
* Assign and actor in a ticket for an authenticated user
*
* @param $params array of options (ticket, id2name)
* @param $protocol the communication protocol used
*
* @return array of hashtable as glpi.getTicket
**/
static function methodsetTicketAssign($params, $protocol)
{
global $DB, $CFG_GLPI;
if (isset($params['help'])) {
return array('ticket' => 'integer,mandatory', 'user' => 'integer,optional', 'supplier' => 'integer,optional', 'group' => 'integer,optional', 'user_email' => 'string,optional', 'use_email_notification' => 'bool,optional', 'help' => 'bool,optional');
}
if (!Session::getLoginUserID()) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED);
}
if (!Session::haveRight("assign_ticket", "1")) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED);
}
if (!isset($params['user']) && !isset($params['group']) && !isset($params['supplier'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'user or group or supplier');
}
$ticket = new Ticket();
if (!isset($params['ticket'])) {
return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'ticket');
}
if (!is_numeric($params['ticket'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'ticket=' . $params['ticket']);
}
if (!$ticket->can($params['ticket'], 'r')) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND);
}
if (!$ticket->getFromDB($params['ticket'])) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, '', 'ticket');
}
$ticket_user = new Ticket_User();
$user = array('tickets_id' => $params['ticket'], 'type' => CommonITILActor::ASSIGN);
// technician : optionnal, default = none
if (isset($params['user'])) {
if (!is_numeric($params['user'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'user');
}
$user['users_id'] = $params['user'];
if ($ticket->getFromDB($params['ticket'])) {
$entity = $ticket->getField('entities_id');
}
if (!$ticket_user->can(-1, 'w', $user) || !self::checkUserRights($params['user'], "own_ticket", 1, $entity)) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED);
}
if ($ticket->isUser(CommonITILActor::ASSIGN, $user['users_id'])) {
return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', 'User already assign for this ticket');
}
if (isset($params['user_email'])) {
if (!NotificationMail::isUserAddressValid($params['user_email'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'user_email');
}
$user['alternative_email'] = $params['user_email'];
$user['use_notification'] = 1;
} else {
if (isset($params['use_email_notification']) && $params['use_email_notification']) {
$user['_additional_assigns'][] = array('users_id' => $params['user'], 'use_notification' => 1);
} else {
if (isset($params['use_email_notification']) && !$params['use_email_notification']) {
$user['_additional_assigns'][] = array('users_id' => $params['user'], 'use_notification' => 0);
}
}
}
if (!$ticket_user->add($user)) {
return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', 'user not assign');
}
}
// group (technicians group) : optionnal, default = none
$group_ticket = new Group_Ticket();
$group = array('tickets_id' => $params['ticket'], 'type' => CommonITILActor::ASSIGN);
if (isset($params['group'])) {
if (!is_numeric($params['group'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'group');
}
$group['groups_id'] = $params['group'];
if (!$group_ticket->can(-1, 'w', $group)) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED);
}
if ($ticket->isGroup(CommonITILActor::ASSIGN, $params['group'])) {
return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', 'Group already assign for this ticket');
}
if (!$group_ticket->add($group)) {
return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', 'group not assign');
}
}
// supplier to assign : optionnal, default = none
$supplier_ticket = new Supplier_Ticket();
$supplier = array('tickets_id' => $params['ticket'], 'type' => CommonITILActor::ASSIGN);
if (isset($params['supplier'])) {
if (!is_numeric($params['supplier'])) {
return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'supplier');
}
$supplier['suppliers_id'] = $params['supplier'];
if (!$supplier_ticket->can(-1, 'w', $supplier)) {
return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED);
//.........这里部分代码省略.........
示例7: canCreateItem
/**
* Is the current user have right to create the current task ?
*
* @return boolean
**/
function canCreateItem()
{
$ticket = new Ticket();
if (!$ticket->can($this->getField('tickets_id'), 'r')) {
return false;
}
return haveRight("global_add_tasks", "1") || $ticket->isUser(Ticket::ASSIGN, getLoginUserID()) || isset($_SESSION["glpigroups"]) && $ticket->haveAGroup(Ticket::ASSIGN, $_SESSION['glpigroups']);
}