opensupports/server/models/APIKey.php

40 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2017-04-21 05:34:20 +02:00
/**
* @api {OBJECT} APIKey APIKey
2022-01-04 17:24:06 +01:00
* @apiVersion 4.11.0
2017-04-21 05:34:20 +02:00
* @apiGroup Data Structures
* @apiParam {String} name Name of the APIKey.
* @apiParam {String} token Token of the APIKey.
*/
class APIKey extends DataStore {
const TABLE = 'apikey';
const TICKET_CREATE_PERMISSION = 'TICKET_CREATE_PERMISSION';
const USER_CREATE_PERMISSION = 'USER_CREATE_PERMISSION';
const TICKET_CHECK_PERMISSION = 'TICKET_CHECK_PERMISSION';
const TICKET_NUMBER_RETURN_PERMISSION = 'TICKET_NUMBER_RETURN_PERMISSION';
const TYPES = [APIKey::TICKET_CREATE_PERMISSION,APIKey::USER_CREATE_PERMISSION,APIKey::TICKET_CHECK_PERMISSION,APIKey::TICKET_NUMBER_RETURN_PERMISSION];
public static function getProps() {
return [
'name',
2019-11-16 20:07:02 +01:00
'token',
'canCreateUsers',
'canCreateTickets',
'canCheckTickets',
'shouldReturnTicketNumber'
];
}
public function toArray() {
return [
'name' => $this->name,
2019-11-16 20:07:02 +01:00
'token' => $this->token,
'canCreateUser' => $this->canCreateUsers,
'canCreateTickets' => $this->canCreateTickets,
'canCheckTickets' => $this->canCheckTickets,
'shouldReturnTicketNumber' => $this->shouldReturnTicketNumber
];
}
}