Working on user context
parent
c184469219
commit
96120bc744
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace BusinessLogic\Security;
|
||||
|
||||
|
||||
class UserContext {
|
||||
public $id;
|
||||
public $username;
|
||||
public $admin;
|
||||
public $name;
|
||||
public $email;
|
||||
public $signature;
|
||||
public $language;
|
||||
public $categories;
|
||||
public $permissions;
|
||||
|
||||
/**
|
||||
* @var UserContextPreferences
|
||||
*/
|
||||
public $preferences;
|
||||
|
||||
/**
|
||||
* @var UserContextNotifications
|
||||
*/
|
||||
public $notificationSettings;
|
||||
public $autoAssign;
|
||||
public $ratingNegative;
|
||||
public $ratingPositive;
|
||||
public $rating;
|
||||
public $totalNumberOfReplies;
|
||||
public $active;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace BusinessLogic\Security;
|
||||
|
||||
|
||||
class UserContextBuilder {
|
||||
static function buildUserContext($authToken, $hesk_settings) {
|
||||
//$userForToken = gateway.getUserForToken($authToken);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a user context based on the current session. **The session must be active!**
|
||||
* @return UserContext the built user context
|
||||
*/
|
||||
static function fromSession() {
|
||||
require_once(__DIR__ . '/UserContext.php');
|
||||
require_once(__DIR__ . '/UserContextPreferences.php');
|
||||
|
||||
$userContext = new UserContext();
|
||||
$userContext->id = $_SESSION['id'];
|
||||
$userContext->username = $_SESSION['user'];
|
||||
$userContext->admin = $_SESSION['isadmin'];
|
||||
$userContext->name = $_SESSION['name'];
|
||||
$userContext->email = $_SESSION['email'];
|
||||
$userContext->signature = $_SESSION['signature'];
|
||||
$userContext->language = $_SESSION['language'];
|
||||
$userContext->categories = explode(',', $_SESSION['categories']);
|
||||
|
||||
$preferences = new UserContextPreferences();
|
||||
$preferences->afterReply = $_SESSION['afterreply'];
|
||||
$preferences->autoStartTimeWorked = $_SESSION['autostart'];
|
||||
$preferences-
|
||||
|
||||
|
||||
return $userContext;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 1/19/17
|
||||
* Time: 8:51 PM
|
||||
*/
|
||||
|
||||
namespace BusinessLogic\Security;
|
||||
|
||||
|
||||
class UserContextNotifications {
|
||||
public $newUnassigned;
|
||||
public $newAssignedToMe;
|
||||
public $replyUnassigned;
|
||||
public $replyToMe;
|
||||
public $privateMessage;
|
||||
public $noteOnTicketAssignedToMe;
|
||||
public $noteOnTicketNotAssignedToMe;
|
||||
public $overdueTicketUnassigned;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 1/19/17
|
||||
* Time: 8:49 PM
|
||||
*/
|
||||
|
||||
namespace BusinessLogic\Security;
|
||||
|
||||
|
||||
class UserContextPreferences {
|
||||
public $afterReply;
|
||||
public $autoStartTimeWorked;
|
||||
public $autoreload;
|
||||
public $defaultNotifyCustomerNewTicket;
|
||||
public $defaultNotifyCustomerReply;
|
||||
public $showSuggestedKnowledgebaseArticles;
|
||||
public $defaultCalendarView;
|
||||
public $defaultTicketView;
|
||||
}
|
Loading…
Reference in New Issue