Skip to content

Commit

Permalink
Merge pull request #7684 from ProcessMaker/observation/FOUR-19940
Browse files Browse the repository at this point in the history
FOUR-19940 `Process Manager` user can not see all Tasks
  • Loading branch information
ryancooley authored Nov 5, 2024
2 parents e2cba8c + 9bf8451 commit bdc16f8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ProcessMaker/Http/Controllers/Api/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ public function index(Request $request, $getTotal = false, User $user = null)
// Apply filter overdue
$query->overdue($request->input('overdue'));

if ($request->input('processesIManage') === 'true') {
$this->applyProcessManager($query, $user);
}

// If only the total is being requested (by a Saved Search), send it now
if ($getTotal === true) {
return $query->count();
Expand Down
15 changes: 15 additions & 0 deletions ProcessMaker/Traits/TaskControllerIndexMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Support\Str;
use ProcessMaker\Filters\Filter;
use ProcessMaker\Managers\DataManager;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\ProcessRequestToken;
use ProcessMaker\Models\User;
Expand Down Expand Up @@ -319,4 +320,18 @@ private function applyForCurrentUser($query, $user)
->orWhereIn('id', $user->availableSelfServiceTaskIds());
});
}

public function applyProcessManager($query, $user)
{
$ids = Process::select(['id'])
->where('properties->manager_id', $user->id)
->where('status', 'ACTIVE')
->get()
->toArray();

$query->orWhere(function ($query) use ($ids) {
$query->whereIn('process_request_tokens.process_id', array_column($ids, 'id'))
->where('process_request_tokens.status', 'ACTIVE');
});
}
}
1 change: 1 addition & 0 deletions resources/js/tasks/components/ListMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const ListMixin = {
}${filterParams
}${this.getSortParam()
}&non_system=true` +
`&processesIManage=${(this.processesIManage ? 'true' : 'false')}` +
advancedFilter +
this.columnsQuery,
{
Expand Down
4 changes: 2 additions & 2 deletions resources/js/tasks/components/TasksList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export default {
type: String,
default: "tasks",
},
verifyUrlToFalse: {
processesIManage: {
type: Boolean,
default: false
}
Expand Down Expand Up @@ -866,7 +866,7 @@ export default {
verifyURL(string) {
const currentUrl = window.location.href;
let isInUrl = currentUrl.includes(string);
if (this.verifyUrlToFalse) {
if (this.processesIManage) {
isInUrl = false;
}
return isInUrl;
Expand Down

0 comments on commit bdc16f8

Please sign in to comment.