New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Super user feature #841
Super user feature #841
Conversation
…into super-user-feature
$authorsMatch = RedBean::getAll($authorsQuery, [':query' => "%" .$query . "%",':queryAtBeginning' => $query . "%"] ); | ||
$authors = []; | ||
if(!$searchUser){ | ||
$sqlQuery = "SELECT id,name,level FROM staff " . $this->generateAuthorsIdQuery($query) . " LIMIT 10"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move SELECT
inside the funcltion, also you only need id,level
server/controllers/ticket/search.php
Outdated
@@ -102,7 +104,8 @@ public function validations() { | |||
} | |||
|
|||
public function handler() { | |||
|
|||
$this->supervisor = Controller::request('supervisor') ? Controller::request('supervisor') : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->ignoreDeparmentFilter = (bool)Controller::request('supervisor')
$superUser = User::getDataStore(Controller::request('userId')); | ||
|
||
foreach ($clearedList as $item) { | ||
if($item == $superUser->id) throw new Exception(ERRORS::SUPERVISOR_CAN_NOT_SELECT_HIMSELF); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SUPERVISOR_CAN_NOT_SUPERVISE_HIMSELF
public function handler() { | ||
$userIdList = $this->getUserIdListCleared(); | ||
$superUser = User::getDataStore(Controller::request('userId')); | ||
$supervisedRelation = SupervisedRelation::getDataStore($superUser->supervisedrelation_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!$superUser->supervisedrelation) {
$superUser->supervisedrelation = new SupervisedRelation();
}
$superUser->supervisedrelation->sharedUserList->clear();
foreach ($userIdList as $userId) {
$user = User::getDataStore($userId);
$superUser->supervisedrelation->sharedUserList->add($user);
}
$superUser->supervisedrelation->store();
$superUser->store();
// Datastorelist
public function clear() {
foreach($index => $item as $this->list) {
unset($this->list[$index]);
}
}
|
||
public function handler() { | ||
$this->page = Controller::request('page') ? Controller::request('page') : 1; | ||
$this->showOwnTickets = Controller::request('showOwnTickets') ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(bool)Controller::request('showOwnTickets')
* @apiPermission user | ||
* | ||
* @apiParam {id[]} supervisedUsers arrays of users Ids. | ||
* @apiParam {boolean} showOwnTickets boolean to show or not own tickets. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
showOwnTickets boolean to show or not current logged user tickets
} | ||
|
||
render() { | ||
return ( | ||
<div className="dashboard-ticket-list"> | ||
<Header title={i18n('TICKET_LIST')} description={i18n('TICKET_LIST_DESCRIPTION')} /> | ||
<TicketList tickets={this.props.tickets} type="primary"/> | ||
{this.props.userUsers ? this.showSupervisorOptions() : null} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it should be this.props.userUsers.length
}); | ||
} | ||
|
||
updateTicketList(object = {}){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateTicketList({users, page, ownTickets}) {
No description provided.