From 5f5b97dad6dc190803c4d3d30a17ac300eb4b275 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 7 Sep 2020 19:27:32 -0400 Subject: [PATCH] Create self-only ACL template and helper method --- src/Core/ACL.php | 21 +++++++++++++++++++++ view/templates/acl/self_only.tpl | 5 +++++ 2 files changed, 26 insertions(+) create mode 100644 view/templates/acl/self_only.tpl diff --git a/src/Core/ACL.php b/src/Core/ACL.php index 4df15dc536..5f69d78b68 100644 --- a/src/Core/ACL.php +++ b/src/Core/ACL.php @@ -83,6 +83,27 @@ class ACL return $o; } + /** + * Returns a minimal ACL block for self-only permissions + * + * @param int $localUserId + * @param string $explanation + * @return string + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function getSelfOnlyHTML(int $localUserId, string $explanation) + { + $selfPublicContactId = Contact::getPublicIdByUserId($localUserId); + + $tpl = Renderer::getMarkupTemplate('acl/self_only.tpl'); + $o = Renderer::replaceMacros($tpl, [ + '$selfPublicContactId' => $selfPublicContactId, + '$explanation' => $explanation, + ]); + + return $o; + } + /** * Return the default permission of the provided user array * diff --git a/view/templates/acl/self_only.tpl b/view/templates/acl/self_only.tpl new file mode 100644 index 0000000000..d1c5a00de8 --- /dev/null +++ b/view/templates/acl/self_only.tpl @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file