CSTicket
in package
This class contains the CONTENTSERV Tickets which are used for authentication
Tags
Table of Contents
- $internalSessionAuthenticated : bool|null
- $lastLogin : int|null
- checkValid() : int
- checks whether a ticket is valid or not
- createTicket() : CSTicket
- creates a new ticket
- deleteTicket() : void
- Deletes a ticket with the given id if exists
- generateTicketID() : int
- generates a unique ticket id
- getLastSessionId() : string
- Returns the last user session identifier that was saved on login
- getLevel() : mixed
- getLoginCount() : int
- returns the count of performed logins for the current ticket
- getMaxLogins() : int
- returns the maximum allowed logins for the current ticket
- getProject() : string
- returns the project property of a ticket
- getTicket() : CSTicket
- if the ticketID parameter is set returns an existing ticket if possible, otherwise an empty ticket
- getTicketFolder() : string
- returns the ticket folder where all tickets are saved to
- getTicketID() : int
- returns the ticket id
- getTicketPath() : string
- returns the path of the ticket file
- getUserID() : int
- returns the user id that belongs to the ticket
- getValidUntil() : timestamp
- returns the validUntil property of the ticket
- readTicket() : object
- reads the ticket with the given id if exists and returns a ticket object
- registerCookieTicket() : void
- registers a ticket in the current cookie
- registerSessionTicket() : void
- registers a ticket in the current session
- setLastSessionId() : mixed
- Saves the user sessionId to avoid multiple accesses with the same account
- ticketFileExists() : bool
- returns true if the ticket file for the current ticket exists, otherwise false
- updateTicket() : void
- updates a ticket
Properties
$internalSessionAuthenticated
public
bool|null
$internalSessionAuthenticated
Tags
$lastLogin
public
int|null
$lastLogin
Tags
Methods
checkValid()
checks whether a ticket is valid or not
public
checkValid() : int
Tags
Return values
int —the user id
createTicket()
creates a new ticket
public
static createTicket(object $user, int $validUntil, int $maxLogins) : CSTicket
Parameters
- $user : object
-
the user object for which to create the ticket
- $validUntil : int
-
amount of seconds the ticket should be valid
- $maxLogins : int
-
maximum amount of logins the user is allowed to make using this ticket
Tags
Return values
CSTicket —a ticket object
deleteTicket()
Deletes a ticket with the given id if exists
public
static deleteTicket(string $ticketID) : void
Parameters
- $ticketID : string
-
the ticket id of the ticket to delete
Tags
Return values
void —generateTicketID()
generates a unique ticket id
public
static generateTicketID(string $userName, string $userPassword, string $project[, bool $isLimited = false ]) : int
Parameters
- $userName : string
-
the user name of the user the ticket id is generated for
- $userPassword : string
-
the user password of the user the ticket id is generated for
- $project : string
-
the project of the user the ticket id is generated for
- $isLimited : bool = false
-
whether the ticket is a limited ticket (max logins, max validation)
Tags
Return values
int —the ticket id
getLastSessionId()
Returns the last user session identifier that was saved on login
public
getLastSessionId() : string
Tags
Return values
string —getLevel()
public
getLevel() : mixed
Tags
Return values
mixed —getLoginCount()
returns the count of performed logins for the current ticket
public
getLoginCount() : int
Tags
Return values
int —the count of performed logins
getMaxLogins()
returns the maximum allowed logins for the current ticket
public
getMaxLogins() : int
Tags
Return values
int —the maximum allowed logins
getProject()
returns the project property of a ticket
public
getProject() : string
Tags
Return values
string —the project name
getTicket()
if the ticketID parameter is set returns an existing ticket if possible, otherwise an empty ticket
public
static getTicket([int $ticketID = '' ]) : CSTicket
Parameters
- $ticketID : int = ''
-
the id of the ticket the object should be returned of
Tags
Return values
CSTicket —a ticket object
getTicketFolder()
returns the ticket folder where all tickets are saved to
public
static getTicketFolder() : string
Tags
Return values
string —the relative path to the ticket folder
getTicketID()
returns the ticket id
public
getTicketID() : int
Tags
Return values
int —the ticket id
getTicketPath()
returns the path of the ticket file
public
getTicketPath([mixed $sTicketId = '' ]) : string
Parameters
- $sTicketId : mixed = ''
Tags
Return values
string —the relative path to the file. This method doesn't check whether the file eixsts, this check has to be performed by the method CSTicket::ticketFileExists()
getUserID()
returns the user id that belongs to the ticket
public
getUserID() : int
Tags
Return values
int —the user id
getValidUntil()
returns the validUntil property of the ticket
public
getValidUntil() : timestamp
Tags
Return values
timestamp —the valid until timestamp
readTicket()
reads the ticket with the given id if exists and returns a ticket object
public
static readTicket(string $ticketID) : object
Parameters
- $ticketID : string
-
the ticket id of the ticket to read
Tags
Return values
object —the ticket object
registerCookieTicket()
registers a ticket in the current cookie
public
registerCookieTicket() : void
Tags
Return values
void —registerSessionTicket()
registers a ticket in the current session
public
registerSessionTicket() : void
Tags
Return values
void —setLastSessionId()
Saves the user sessionId to avoid multiple accesses with the same account
public
setLastSessionId(string $sNewSessionId) : mixed
Parameters
- $sNewSessionId : string
Tags
Return values
mixed —ticketFileExists()
returns true if the ticket file for the current ticket exists, otherwise false
public
ticketFileExists() : bool
Tags
Return values
bool —true if ticket file exists, otherwise false
updateTicket()
updates a ticket
public
updateTicket() : void
