Skip to content
Permalink
Browse files

task: Implement edit of task thread

This fixes an issue where, for task threads, if an agent has the thread edit
permission, the agent was neither able to edit his or her own entries, nor the
entries of other agents.
  • Loading branch information...
greezybacon committed Jun 3, 2019
1 parent 35b260f commit 394ddee8d744546a55bc24842606f3bdb13d88de
Showing with 25 additions and 2 deletions.
  1. +18 −2 include/class.task.php
  2. +7 −0 include/class.thread_actions.php
@@ -204,8 +204,24 @@ protected function reopen() {
return $this->setFlag(self::ISOPEN);
}
function isAssigned() {
return ($this->isOpen() && ($this->getStaffId() || $this->getTeamId()));
function isAssigned($to=null) {
if (!$this->isOpen())
return false;
if (is_null($to))
return ($this->getStaffId() || $this->getTeamId());
switch (true) {
case $to instanceof Staff:
return ($to->getId() == $this->getStaffId() ||
$to->isTeamMember($this->getTeamId()));
break;
case $to instanceof Team:
return ($to->getId() == $this->getTeamId());
break;
}
return false;
}
function isOverdue() {
@@ -138,6 +138,13 @@ function isEnabled() {
&& ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff)))
&& $role->hasPerm(ThreadEntry::PERM_EDIT)
)
|| ($T instanceof Task
&& $T->getDept()->getManagerId() == $thisstaff->getId()
)
|| ($T instanceof Task
&& ($role = $thisstaff->getRole($T->getDeptId(), $T->isAssigned($thisstaff)))
&& $role->hasPerm(ThreadEntry::PERM_EDIT)
)
);
}

0 comments on commit 394ddee

Please sign in to comment.
You can’t perform that action at this time.