Create self-only ACL template and helper method

This commit is contained in:
Hypolite Petovan 2020-09-07 19:27:32 -04:00
parent c4267bbca0
commit 5f5b97dad6
2 changed files with 26 additions and 0 deletions

View file

@ -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
*

View file

@ -0,0 +1,5 @@
<input type="hidden" name="contact_allow" value="{{$selfPublicContactId}}">
<input type="hidden" name="group_allow" value="">
<input type="hidden" name="contact_deny" value="">
<input type="hidden" name="group_deny" value="">
<div class="alert alert-info" role="alert"><p>{{$explanation}}</p></div>