Rewrite of the authentication and authorization system
This commit is contained in:
55
app/Formatter/GroupAutoCompleteFormatter.php
Normal file
55
app/Formatter/GroupAutoCompleteFormatter.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Formatter;
|
||||
|
||||
/**
|
||||
* Autocomplete formatter for groups
|
||||
*
|
||||
* @package formatter
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class GroupAutoCompleteFormatter implements FormatterInterface
|
||||
{
|
||||
/**
|
||||
* Groups found
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
private $groups;
|
||||
|
||||
/**
|
||||
* Format groups for the ajax autocompletion
|
||||
*
|
||||
* @access public
|
||||
* @param array $groups
|
||||
* @return GroupAutoCompleteFormatter
|
||||
*/
|
||||
public function setGroups(array $groups)
|
||||
{
|
||||
$this->groups = $groups;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format groups for the ajax autocompletion
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function format()
|
||||
{
|
||||
$result = array();
|
||||
|
||||
foreach ($this->groups as $group) {
|
||||
$result[] = array(
|
||||
'id' => $group->getInternalId(),
|
||||
'external_id' => $group->getExternalId(),
|
||||
'value' => $group->getName(),
|
||||
'label' => $group->getName(),
|
||||
);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class ProjectGanttFormatter extends Project implements FormatterInterface
|
||||
'gantt_link' => $this->helper->url->href('gantt', 'project', array('project_id' => $project['id'])),
|
||||
'color' => $color,
|
||||
'not_defined' => empty($project['start_date']) || empty($project['end_date']),
|
||||
'users' => $this->projectPermission->getProjectUsers($project['id']),
|
||||
'users' => $this->projectUserRole->getAllUsersGroupedByRole($project['id']),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
38
app/Formatter/UserFilterAutoCompleteFormatter.php
Normal file
38
app/Formatter/UserFilterAutoCompleteFormatter.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Kanboard\Formatter;
|
||||
|
||||
use Kanboard\Model\User;
|
||||
use Kanboard\Model\UserFilter;
|
||||
|
||||
/**
|
||||
* Autocomplete formatter for user filter
|
||||
*
|
||||
* @package formatter
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class UserFilterAutoCompleteFormatter extends UserFilter implements FormatterInterface
|
||||
{
|
||||
/**
|
||||
* Format the tasks for the ajax autocompletion
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function format()
|
||||
{
|
||||
$users = $this->query->columns(User::TABLE.'.id', User::TABLE.'.username', User::TABLE.'.name')->findAll();
|
||||
|
||||
foreach ($users as &$user) {
|
||||
$user['value'] = $user['username'].' (#'.$user['id'].')';
|
||||
|
||||
if (empty($user['name'])) {
|
||||
$user['label'] = $user['username'];
|
||||
} else {
|
||||
$user['label'] = $user['name'].' ('.$user['username'].')';
|
||||
}
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user