Skip to content

Commit

Permalink
Merge branch 'release-2024-fall' of github.com:ProcessMaker/processma…
Browse files Browse the repository at this point in the history
…ker into observation/FOUR-21249
  • Loading branch information
gustavobascope committed Dec 17, 2024
2 parents 0e19abb + d5aed66 commit 1ddd039
Show file tree
Hide file tree
Showing 11 changed files with 94 additions and 31 deletions.
69 changes: 69 additions & 0 deletions ProcessMaker/Console/Commands/RevokeOauthAccessTokens.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace ProcessMaker\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;

class RevokeOauthAccessTokens extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'processmaker:revoke-oauth-access-tokens {--name=} {--after=} {--client_id=} {--no-interaction|n}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Revoke oauth access tokens for a given token name, client_id, or after a given date';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$name = $this->option('name');
$after = $this->option('after');
$clientId = $this->option('client_id');
$noInteraction = $this->option('no-interaction');

if (!$name && !$after && !$clientId) {
$this->error('At least one of --name, --after, or --client_id must be specified.');
return;
}

if (!$noInteraction && !$this->confirm('Are you sure you want to revoke this certificate?')) {
$this->info('Certificate revocation cancelled.');
return;
}

$query = DB::table('oauth_access_tokens')->where('revoked', false);

if ($name) {
$names = explode(',', $name);
$query->whereIn('name', $names);
}

if ($after) {
$date = Carbon::createFromFormat('Y-m-d', $after);
$query->where('created_at', '>', $date);
}

if ($clientId) {
$clientIds = explode(',', $clientId);
$query->whereIn('client_id', $clientIds);
}

$revokedCount = $query->update(['revoked' => true]);

$this->info("Revoked $revokedCount tokens.");
}
}
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "processmaker/processmaker",
"version": "4.12.0",
"version": "4.12.1",
"description": "BPM PHP Software",
"keywords": [
"php bpm processmaker"
Expand Down Expand Up @@ -107,7 +107,7 @@
"Gmail"
],
"processmaker": {
"build": "fe0627fe",
"build": "4c2786fd",
"cicd-enabled": true,
"custom": {
"package-ellucian-ethos": "1.17.0",
Expand Down Expand Up @@ -156,11 +156,11 @@
"package-cdata": "1.4.5",
"package-collections": "2.20.0",
"package-comments": "1.15.0",
"package-conversational-forms": "1.11.0",
"package-data-sources": "1.30.0",
"package-decision-engine": "1.12.0",
"package-conversational-forms": "1.11.1",
"package-data-sources": "1.30.1",
"package-decision-engine": "1.12.1",
"package-dynamic-ui": "1.24.0",
"package-files": "1.19.0",
"package-files": "1.19.2",
"package-googleplaces": "1.12.0",
"package-photo-video": "1.6.0",
"package-pm-blocks": "1.9.0",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@processmaker/processmaker",
"version": "4.12.0",
"version": "4.12.1",
"description": "ProcessMaker 4",
"author": "DevOps <[email protected]>",
"license": "ISC",
Expand Down
10 changes: 8 additions & 2 deletions resources/js/components/shared/FilterTableBodyMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ export default {
};
},
formatCategory(categories) {
return categories.map(item => item.name).join(', ');
return categories?.map(item => item.name).join(', ');
},
getNestedPropertyValue(obj, header) {
return this.format(get(obj, header.field), header);
const value = get(obj, header.field);

if (typeof header.cb === 'function') {
return header.cb(value, obj);
}

return this.format(value, header);
},
format(value, header) {
let config = "";
Expand Down
6 changes: 2 additions & 4 deletions resources/js/processes/screens/components/ScreenListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,12 @@ export default {
title: () => this.$t("Category"),
name: "categories",
label: this.$t("Category"),
field: "category.name",
field: "categories",
sortable: true,
direction: "none",
width: 150,
sortField: "category.name",
callback(categories) {
return categories.map(item => item.name).join(', ');
},
cb: (categories) => this.formatCategory(categories),
},
{
title: () => this.$t("Type"),
Expand Down
6 changes: 2 additions & 4 deletions resources/js/processes/scripts/components/ScriptListing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,11 @@ export default {
name: "categories",
sortField: "category.name",
label: this.$t("Category"),
field: "category.name",
field: "categories",
sortable: true,
direction: "none",
width: 150,
callback(categories) {
return categories.map(item => item.name).join(', ');
},
cb: (categories) => this.formatCategory(categories),
},
{
title: () => this.$t("Language"),
Expand Down
9 changes: 0 additions & 9 deletions resources/views/processes/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ class="invalid-feedback"
</div>
</b-col>
<b-col>
<div class="form-group">
<select-user-group
:label="$t('Reassignment Permission')"
v-model="reassignmentPermissions"
:multiple="true"
:activeTasksCount="true"
/>
<small>{{__('In addition to the process manager, these users and groups will have permission to reassign any task in this process, regardless of the "Allow Reassignment" task setting.')}}</small>
</div>
</b-col>
</b-row>
</div>
Expand Down
2 changes: 1 addition & 1 deletion routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
Route::put('password/change', [ChangePasswordController::class, 'update'])->name('password.update');
Route::put('users/update_language', [UserController::class, 'updateLanguage'])->name('users.updateLanguage');
Route::get('users_task_count', [UserController::class, 'getUsersTaskCount'])->name('users.users_task_count')
->middleware('can:view-users|create-processes|edit-processes|create-projects|view-projects');
->middleware('can:view-users');

// User Groups
Route::put('users/{user}/groups', [UserController::class, 'updateGroups'])->name('users.groups.update')->middleware('can:edit-users');
Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/Api/UsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@ public function testGetUsersTaskCount()
$users = $result->json()['data'];

// Assert only the $user and $groupUser are in the list
$this->assertEqualsCanonicalizing([$user->id, $groupUser->id], collect($users)->pluck('id')->toArray());
$this->assertContains($user->id, array_column($users, 'id'));
$this->assertContains($groupUser->id, array_column($users, 'id'));

// Assert the $user has 3 active tasks
$tokenCount = collect($users)->first(fn ($r) => $r['id'] === $user->id)['active_tasks_count'];
Expand Down

0 comments on commit 1ddd039

Please sign in to comment.