Looking for file manager with restrictions

Hello,

I am using Yii2 and I find it great to develop web-apps.

I would need a file manager to upload/view/link documents, but I need that documents belongs to categories with rights management:

I mean I have users editing the education category (with multiple articles) and I do not want them to be able to manage documents belonging to sport category.

Is there some file manager extensions able to do that?

In https://github.com/d3yii2/d3files is realised access control by controller using standard RBAC. Realy standard solution.

Thank you for the answer, I am trying to install it, but I don’t understand in which file I have to put these lines :

I have the Yii2 advanced template and want to use the extension in the backend.

Can you help me please ?

Just ignore that and run the migrations manually.

OK, but how I do the migration manually?

I use https://github.com/dmstr/yii2-migrate-command for setting all module migration.

OR

yii migrate --migrationPath=@app/modules/forum/migrations

I have Yii 2.0.12

Here is my console/config/main.php :


return [

    'id' => 'app-console',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log'],

    'controllerNamespace' => 'console\controllers',

    'controllerMap' => [

        'fixture' => [

            'class' => 'yii\console\controllers\FixtureController',

            'namespace' => 'common\fixtures',

          ],

        'migrate' => [

            'class' => \yii\console\controllers\MigrateController::class,

            'migrationNamespaces' => [

                'Da\User\Migration',

            ],


        ],

    ],

    'modules' => [

        'user' =>  Da\User\Module::class,

    ],

    'components' => [

        'log' => [

            'targets' => [

                [

                    'class' => 'yii\log\FileTarget',

                    'levels' => ['error', 'warning'],

                ],

            ],

        ],

    ],

    'params' => $params,


];

Where do I have to add the configuration to do the migration ?





$basePath = dirname(dirname(dirname(dirname(__DIR__))));


$params = require(__DIR__ . '/params.php');

$aliases = require(__DIR__ . '/aliases.php');

$db = require(__DIR__ . '/db.php');




return  [

    'id' => 'basic-console',

    'basePath' => dirname(__DIR__),

    'bootstrap' => ['log', 'coalmar\delivery\Bootstrap'],

    'controllerNamespace' => 'app\commands',

    'controllerMap' => [

        'migrate' => 'dmstr\console\controllers\MigrateController',

    ],

    'modules' => [

          ......

    ],    

    'components' =>

    [

        'i18n' => [

            'translations' => require 'translations.php',

        ],        

        'cache' => [

            'class' => 'yii\caching\FileCache',

            'fileMode' => 0666,

        ],

        'log' => [

            'traceLevel' => getenv('YII_TRACE_LEVEL'),

            'targets' => [

                [

                    'class' => 'yii\log\FileTarget',

//                    'prefix' => function () {

//                        return '[console]';

//                    },

                    'levels' => YII_DEBUG ? ['error', 'warning', 'info'] : ['error', 'warning'],

                    'logFile' => $basePath . '/runtime/logs/console.log',

                    'dirMode' => 0777,

                    'exportInterval' => 1, // <-- and here

                ],

                [

                    'class' => 'yii\log\EmailTarget',

                    'levels' => ['error', 'warning'],

                    'message' => [

                        'from' => ['aaaa@aaaa.lv'],

                        'to' => ['fffff@gmail.com'],

                        'subject' => 'Errors COALMAR',

                    ],

                ],

            ],

        ],

        'db' => $db,

        'authManager' => [

            'class' => 'yii2d3\d3persons\components\D3AuthManager',

        ],

    ],

    'aliases' => array_merge($aliases, [

        '@vendor' => rtrim($basePath, '\\/') . '/vendor',

    ]),

    'params' => array_merge($params,[

        'yii.migrations' => [

                '@dektrium/yii2-user/migrations',

                '@yii/rbac/migrations',

                '@vendor/d3yii2/d3files/migrations',

                '@vendor/cornernote/yii2-dashboard/src/migrations',

            ]

    ]),

];




I have added:


    'params' => array_merge($params,[

        'yii.migrations' => [

            '@vendor/d3yii2/d3files/migrations',

        ],

    ]),

But when I launch yii migrate it tells me:


Yii Migration Tool (based on Yii v2.0.12)


No new migrations found. Your system is up-to-date.

Please install https://github.com/dmstr/yii2-migrate-command

and changhe in console config




    'controllerMap' => [

        'migrate' => 'dmstr\console\controllers\MigrateController',

    ],



Ok, but it’s written as deprecated in the doc

and that it is supported in framework core so I have added in the ‘controllerMap’ => [


        // Migrations for the specific extension

        'migrate-d3files' => [

            'class' => 'yii\console\controllers\MigrateController',

            'migrationPath' => '@vendor/d3yii2/d3files/migrations',


        ],

and then run a yii migrate-d3files

The migration is ok, I’ll try the module now :wink: