From 049639aaf11c54e3b596c523fd85554dd4d8e25e Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 17 Dec 2016 21:01:50 +0100 Subject: [PATCH] admin section of auth app --- ipf/auth/admin.php | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/ipf/auth/admin.php b/ipf/auth/admin.php index ccd9d08..831749a 100644 --- a/ipf/auth/admin.php +++ b/ipf/auth/admin.php @@ -2,6 +2,8 @@ namespace IPF\Auth\Admin; +use IPF_Project; +use IPF_Application; use \IPF\Auth\Role as Role; use \IPF\Auth\Permission as Permission; use \PFF\HtmlBuilder\Text as Text; @@ -350,14 +352,20 @@ class AdminRole extends \IPF_Admin_Component public function slug() { return 'role'; } } -if (\PFF\Container::auth()->arePermissionsEnabled()) { - return array( - 'IPF\Auth\Admin\AdminUser', - 'IPF\Auth\Admin\AdminRole', - ); -} else { - return array( - 'IPF\Auth\Admin\AdminUser', - ); +class AuthAdminSection implements \IPF_Admin_ISection +{ + public function components(IPF_Project $project, IPF_Application $app) + { + $components = array( + new AdminUser(), + ); + + if ($app->arePermissionsEnabled()) { + $components[] = new AdminRole(); + } + + return $components; + } } +return new AuthAdminSection; -- 2.49.0