]> git.andy128k.dev Git - ipf.git/commitdiff
admin section of auth app
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 17 Dec 2016 20:01:50 +0000 (21:01 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 17 Dec 2016 20:01:50 +0000 (21:01 +0100)
ipf/auth/admin.php

index ccd9d083c5711c58bc8abca0baad36e25cd8362b..831749a73350d1a02166c5c31a64c5bcb435c656 100644 (file)
@@ -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;