diff options
Diffstat (limited to 'app/Model')
| -rw-r--r-- | app/Model/Acl.php | 4 | ||||
| -rw-r--r-- | app/Model/Action.php | 1 | ||||
| -rw-r--r-- | app/Model/TaskFilter.php | 27 | ||||
| -rw-r--r-- | app/Model/TaskFinder.php | 3 | ||||
| -rw-r--r-- | app/Model/User.php | 14 |
5 files changed, 43 insertions, 6 deletions
diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 09638302..b9c06e98 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -18,12 +18,12 @@ class Acl extends Base */ private $public_acl = array( 'auth' => array('login', 'check'), - 'user' => array('google', 'github'), 'task' => array('readonly'), 'board' => array('readonly'), 'webhook' => '*', 'ical' => '*', 'feed' => '*', + 'oauth' => array('google', 'github'), ); /** @@ -70,7 +70,7 @@ class Acl extends Base * @var array */ private $admin_acl = array( - 'user' => array('index', 'create', 'save', 'remove'), + 'user' => array('index', 'create', 'save', 'remove', 'authentication'), 'config' => '*', 'link' => '*', 'project' => array('remove'), diff --git a/app/Model/Action.php b/app/Model/Action.php index d0607794..5e994c99 100644 --- a/app/Model/Action.php +++ b/app/Model/Action.php @@ -92,6 +92,7 @@ class Action extends Base GitlabWebhook::EVENT_COMMIT => t('Gitlab commit received'), GitlabWebhook::EVENT_ISSUE_OPENED => t('Gitlab issue opened'), GitlabWebhook::EVENT_ISSUE_CLOSED => t('Gitlab issue closed'), + GitlabWebhook::EVENT_ISSUE_COMMENT => t('Gitlab issue comment created'), BitbucketWebhook::EVENT_COMMIT => t('Bitbucket commit received'), BitbucketWebhook::EVENT_ISSUE_OPENED => t('Bitbucket issue opened'), BitbucketWebhook::EVENT_ISSUE_CLOSED => t('Bitbucket issue closed'), diff --git a/app/Model/TaskFilter.php b/app/Model/TaskFilter.php index 8d7bdb44..d7d5148b 100644 --- a/app/Model/TaskFilter.php +++ b/app/Model/TaskFilter.php @@ -71,6 +71,9 @@ class TaskFilter extends Base case 'T_REFERENCE': $this->filterByReference($value); break; + case 'T_SWIMLANE': + $this->filterBySwimlaneName($value); + break; } } @@ -247,6 +250,30 @@ class TaskFilter extends Base } /** + * Filter by swimlane name + * + * @access public + * @param array $values List of swimlane name + * @return TaskFilter + */ + public function filterBySwimlaneName(array $values) + { + $this->query->beginOr(); + + foreach ($values as $swimlane) { + if ($swimlane === 'default') { + $this->query->eq(Task::TABLE.'.swimlane_id', 0); + } + else { + $this->query->ilike(Swimlane::TABLE.'.name', $swimlane); + $this->query->addCondition(Task::TABLE.'.swimlane_id=0 AND '.Project::TABLE.'.default_swimlane '.$this->db->getDriver()->getOperator('ILIKE')." '$swimlane'"); + } + } + + $this->query->closeOr(); + } + + /** * Filter by category id * * @access public diff --git a/app/Model/TaskFinder.php b/app/Model/TaskFinder.php index 2b0453a5..47a67a35 100644 --- a/app/Model/TaskFinder.php +++ b/app/Model/TaskFinder.php @@ -88,11 +88,14 @@ class TaskFinder extends Base Category::TABLE.'.name AS category_name', Category::TABLE.'.description AS category_description', Board::TABLE.'.title AS column_name', + Swimlane::TABLE.'.name AS swimlane_name', + Project::TABLE.'.default_swimlane', Project::TABLE.'.name AS project_name' ) ->join(User::TABLE, 'id', 'owner_id', Task::TABLE) ->join(Category::TABLE, 'id', 'category_id', Task::TABLE) ->join(Board::TABLE, 'id', 'column_id', Task::TABLE) + ->join(Swimlane::TABLE, 'id', 'swimlane_id', Task::TABLE) ->join(Project::TABLE, 'id', 'project_id', Task::TABLE); } diff --git a/app/Model/User.php b/app/Model/User.php index 4c32942c..b6804abc 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -122,13 +122,13 @@ class User extends Base } /** - * Get a specific user by the GitHub id + * Get a specific user by the Github id * * @access public - * @param string $github_id GitHub user id + * @param string $github_id Github user id * @return array|boolean */ - public function getByGitHubId($github_id) + public function getByGithubId($github_id) { if (empty($github_id)) { return false; @@ -377,6 +377,7 @@ class User extends Base new Validators\Unique('username', t('The username must be unique'), $this->db->getConnection(), self::TABLE, 'id'), new Validators\Email('email', t('Email address invalid')), new Validators\Integer('is_admin', t('This value must be an integer')), + new Validators\Integer('is_ldap_user', t('This value must be an integer')), ); } @@ -409,7 +410,12 @@ class User extends Base new Validators\Required('username', t('The username is required')), ); - $v = new Validator($values, array_merge($rules, $this->commonValidationRules(), $this->commonPasswordValidationRules())); + if (isset($values['is_ldap_user']) && $values['is_ldap_user'] == 1) { + $v = new Validator($values, array_merge($rules, $this->commonValidationRules())); + } + else { + $v = new Validator($values, array_merge($rules, $this->commonValidationRules(), $this->commonPasswordValidationRules())); + } return array( $v->execute(), |
