You can use the access control system to differentiate access to files and folders for different users. For this you need to make the following settings. Open configuration file - config/file-manager.php
-
Turn ON ACL system and add fm-acl middleware
// set true 'acl' => true, // add acl middleware to your array 'middleware' => ['web', 'fm-acl'],
-
You can hide files and folders to which the user does not have access(access = 0).
'aclHideFromFM' => true,
-
ACL system operation strategies:
/** * ACL strategy * * blacklist - Allow everything(access - 2 - r/w) that is not forbidden by the ACL rules list * * whitelist - Deny anything(access - 0 - deny), that not allowed by the ACL rules list */ 'aclStrategy' => 'blacklist',
-
Set the rule repository, the default is the configuration file.
/** * ACL rules repository * * default - config file(ConfigACLRepository) */ 'aclRepository' => \Alexusmai\LaravelFileManager\ACLService\ConfigACLRepository::class,
Now you can add your rules in 'aclRules' array. But if you want to store your rules in another place, such as a database, you need to create your own class, and implements two functions from ACLRepository.
I have already made a similar class for an example, and if it suits you, you can use it. You only need to replace the repository name in the configuration file. And add a new migration to the database.
php artisan vendor:publish --tag=fm-migrations
See /src/ACLService/DBACLRepository.php and /migrations/2019_02_06_174631_make_acl_rules_table.php