From c68aefb847b09daa0697de7684d3451e2e68ce1e Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 09 Jul 2026 23:10:23 +0000
Subject: [PATCH] =Refactor of Integrations.php to be a bit more useful with a suite of methods for create, update, delete back and forths for integrations where sharing is enabled. Also considering a single instance with a connect method to connect as the site (no user) vs connecting as an individual user - rather than recreating instances for every user.
---
inc/managers/RoleManager.php | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/inc/managers/RoleManager.php b/inc/managers/RoleManager.php
index a22b585..e859813 100644
--- a/inc/managers/RoleManager.php
+++ b/inc/managers/RoleManager.php
@@ -441,9 +441,9 @@
$content = jvbNoBase($content);
$registrar = Registrar::getInstance($content);
if ($registrar && $registrar->getPlural()) {
- return str_replace(' ', '_', $registrar->getPlural());
+ return strtolower(str_replace(' ', '_', $registrar->getPlural()));
}
- return str_replace(' ', '_', $content.'s');
+ return strtolower(str_replace(' ', '_', $content.'s'));
}
public static function activate(): void
@@ -821,6 +821,18 @@
}
return null;
}
+ public static function getPermissionName(string $action, string $content, ?int $ID = null):?string
+ {
+ $plural = (new self())->getContentPlural($content);
+ switch ($action) {
+ case 'edit':
+ if ($ID) {
+ return "edit_{$content}";
+ }
+ return "edit_{$plural}";
+ }
+ return null;
+ }
public function maybeSwitchPermissions(int $object_id, array $terms, array $tt_ids, string $taxonomy, bool $append, array $old_tt_ids):void
{
--
Gitblit v1.10.0