From 1a737be2b408135177a9e94dcffd0f68c0aca90b Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Tue, 5 Sep 2017 00:23:42 +0200 Subject: :bulb: Improving Doxygen documentation. Fix some Doxygen parsing errors. Improve hooks documentation. --- Zotlabs/Access/Permissions.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'Zotlabs/Access/Permissions.php') diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php index 62c4af0ff..20ce21238 100644 --- a/Zotlabs/Access/Permissions.php +++ b/Zotlabs/Access/Permissions.php @@ -33,19 +33,22 @@ use Zotlabs\Lib as Zlib; */ class Permissions { + /** + * @brief Permissions version. + * + * This must match the version in PermissionRoles.php before permission updates can run. + * + * @return number + */ static public function version() { - // This must match the version in PermissionRoles.php before permission updates can run. return 2; } /** * @brief Return an array with Permissions. * - * @hooks permissions_list - * * \e array \b permissions - * * \e string \b filter - * @param string $filter (optional) only passed to hook permission_list - * @return Associative array with permissions and short description. + * @param string $filter (optional) only passed to hook permissions_list + * @return array Associative array with permissions and short description. */ static public function Perms($filter = '') { @@ -74,6 +77,11 @@ class Permissions { 'permissions' => $perms, 'filter' => $filter ]; + /** + * @hooks permissions_list + * * \e array \b permissions + * * \e string \b filter + */ call_hooks('permissions_list', $x); return($x['permissions']); @@ -84,9 +92,7 @@ class Permissions { * * e.g. you must be authenticated. * - * @hooks write_perms - * * \e array \b permissions - * @return Associative array with permissions and short description. + * @return array Associative array with permissions and short description. */ static public function BlockedAnonPerms() { @@ -99,6 +105,10 @@ class Permissions { } $x = ['permissions' => $res]; + /** + * @hooks write_perms + * * \e array \b permissions + */ call_hooks('write_perms', $x); return($x['permissions']); @@ -138,7 +148,7 @@ class Permissions { * to [ 0 => ['name' => 'view_stream', 'value' => 1], ... ] * * @param array $arr associative perms array 'view_stream' => 1 - * @return Indexed array with elements that look like + * @return array Indexed array with elements that look like * * \e string \b name the perm name (e.g. view_stream) * * \e int \b value the value of the perm (e.g. 1) */ @@ -197,11 +207,10 @@ class Permissions { * @brief * * @param int $channel_id A channel id - * @return associative array + * @return array Associative array with * * \e array \b perms Permission array * * \e int \b automatic 0 or 1 */ - static public function connect_perms($channel_id) { $my_perms = []; -- cgit v1.2.3 From 6cf3ebb7dbf813d92342d0350078edbcd5050e9c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Mon, 6 Nov 2017 23:28:44 +0100 Subject: :ok_hand: Fix a PHP warning in Permissions::FilledPerms(). When NULL is passed as parameter there is a PHP warning when testing against it in the function in_array(). --- Zotlabs/Access/Permissions.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Access/Permissions.php') diff --git a/Zotlabs/Access/Permissions.php b/Zotlabs/Access/Permissions.php index 20ce21238..bca40a9c1 100644 --- a/Zotlabs/Access/Permissions.php +++ b/Zotlabs/Access/Permissions.php @@ -127,6 +127,7 @@ class Permissions { static public function FilledPerms($arr) { if(is_null($arr)) { btlogger('FilledPerms: null'); + $arr = []; } $everything = self::Perms(); -- cgit v1.2.3