Skip to content

Commit

Permalink
Merge branch 'release/v2.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexusmai committed Mar 3, 2019
2 parents f0b253d + b3b0def commit aaeec4e
Show file tree
Hide file tree
Showing 34 changed files with 1,072 additions and 49 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* [Configuration](./docs/configuration.md)
* [Integration](./docs/integration.md)
* [ACL](./docs/acl.md)
* [Events](./docs/events.md)

## Features

Expand Down Expand Up @@ -58,8 +59,32 @@
* whitelist - Deny everything, that not allowed by the ACL rules list
* You can use different repositories for the rules - an array (configuration file), a database (there is an example implementation), or you can add your own.
* You can hide files and folders that are not accessible.
* Events (v2.2)
* Supported locales : ru, en, ar

## Upgrading to version 2.2

If you using ACL change namespace in config file for 'aclRepository'

```php
// From
'aclRepository' => Alexusmai\LaravelFileManager\ACLService\ConfigACLRepository::class,

// To
'aclRepository' => Alexusmai\LaravelFileManager\Services\ACLService\ConfigACLRepository::class,
```

if you create your own repository for ACL rules, don't be forget change namespace to:

```php
// From
Alexusmai\LaravelFileManager\ACLService;

// To
Alexusmai\LaravelFileManager\Services\ACLService;
```


## Thanks

* Khalid Bj [D34DlyM4N](https://github.com/D34DlyM4N)
Expand Down
4 changes: 2 additions & 2 deletions config/file-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
*
* default - config file(ConfigACLRepository)
*/
'aclRepository' => Alexusmai\LaravelFileManager\ACLService\ConfigACLRepository::class,
//'aclRepository' => Alexusmai\LaravelFileManager\ACLService\DBACLRepository::class,
'aclRepository' => Alexusmai\LaravelFileManager\Services\ACLService\ConfigACLRepository::class,
//'aclRepository' => Alexusmai\LaravelFileManager\Services\ACLService\DBACLRepository::class,

/**
* ACL rules list - used for default repository
Expand Down
15 changes: 10 additions & 5 deletions docs/acl.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## ACL
# ACL

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.
Expand Down Expand Up @@ -40,7 +40,7 @@ Open configuration file - config/file-manager.php
*
* default - config file(ConfigACLRepository)
*/
'aclRepository' => \Alexusmai\LaravelFileManager\ACLService\ConfigACLRepository::class,
'aclRepository' => \Alexusmai\LaravelFileManager\Services\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.
Expand All @@ -51,7 +51,7 @@ Open configuration file - config/file-manager.php
php artisan vendor:publish --tag=fm-migrations
```

See [/src/ACLService/DBACLRepository.php](./../src/ACLService/DBACLRepository.php) and [/migrations/2019_02_06_174631_make_acl_rules_table.php](./../migrations/2019_02_06_174631_make_acl_rules_table.php)
See [/src/Services/ACLService/DBACLRepository.php](../src/Services/ACLService/DBACLRepository.php) and [/migrations/2019_02_06_174631_make_acl_rules_table.php](./../migrations/2019_02_06_174631_make_acl_rules_table.php)

## Example 1

Expand All @@ -63,7 +63,7 @@ I have disk 'images' in /config/filesystems.php for folder /public/images
'images' => [
'driver' => 'local',
'root' => public_path('images'),
'url' => '/images/',
'url' => env('APP_URL').'/images/',
],
]
```
Expand Down Expand Up @@ -117,7 +117,7 @@ I add this disk to file-manager config file

namespace App\Http;

use Alexusmai\LaravelFileManager\ACLService\ACLRepository;
use Alexusmai\LaravelFileManager\Services\ACLService\ACLRepository;

class UsersACLRepository implements ACLRepository
{
Expand Down Expand Up @@ -181,3 +181,8 @@ class UsersACLRepository implements ACLRepository
*/
'aclRepository' => \App\Http\UsersACLRepository::class,
```


## What's next

[Events](./events.md)
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Configuration
# Configuration

Open configuration file - config/file-manager.php

Expand Down
207 changes: 207 additions & 0 deletions docs/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
# Events

### DiskSelected

> Alexusmai\LaravelFileManager\Events\DiskSelected
Example:

```php
\Event::listen('Alexusmai\LaravelFileManager\Events\DiskSelected',
function ($event) {
\Log::info('DiskSelected:', [$event->disk()]);
}
);
```

### FilesUploading

> Alexusmai\LaravelFileManager\Events\FilesUploading
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\FilesUploading',
function ($event) {
\Log::info('FilesUploading:', [
$event->disk(),
$event->path(),
$event->files(),
$event->overwrite(),
]);
}
);
```

### FilesUploaded

> Alexusmai\LaravelFileManager\Events\FilesUploaded
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\FilesUploaded',
function ($event) {
\Log::info('FilesUploaded:', [
$event->disk(),
$event->path(),
$event->files(),
$event->overwrite(),
]);
}
);
```

### Deleting

> Alexusmai\LaravelFileManager\Events\Deleting
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\Deleting',
function ($event) {
\Log::info('Deleting:', [
$event->disk(),
$event->items(),
]);
}
);
```

### Deleted

> Alexusmai\LaravelFileManager\Events\Deleted
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\Deleted',
function ($event) {
\Log::info('Deleted:', [
$event->disk(),
$event->items(),
]);
}
);
```

### Paste

> Alexusmai\LaravelFileManager\Events\Paste
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\Paste',
function ($event) {
\Log::info('Paste:', [
$event->disk(),
$event->path(),
$event->clipboard(),
]);
}
);
```

### Rename

> Alexusmai\LaravelFileManager\Events\Rename
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\Rename',
function ($event) {
\Log::info('Rename:', [
$event->disk(),
$event->newName(),
$event->oldName(),
]);
}
);
```

### Download

> Alexusmai\LaravelFileManager\Events\Download
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\Download',
function ($event) {
\Log::info('Download:', [
$event->disk(),
$event->path(),
]);
}
);
```

*When using a text editor, the file you are editing is also downloaded! And this event is triggered!*

### DirectoryCreating

> Alexusmai\LaravelFileManager\Events\DirectoryCreating
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\DirectoryCreating',
function ($event) {
\Log::info('DirectoryCreating:', [
$event->disk(),
$event->path(),
$event->name(),
]);
}
);
```

### DirectoryCreated

> Alexusmai\LaravelFileManager\Events\DirectoryCreated
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\DirectoryCreated',
function ($event) {
\Log::info('DirectoryCreated:', [
$event->disk(),
$event->path(),
$event->name(),
]);
}
);
```

### FileCreating

> Alexusmai\LaravelFileManager\Events\FileCreating
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\FileCreating',
function ($event) {
\Log::info('FileCreating:', [
$event->disk(),
$event->path(),
$event->name(),
]);
}
);
```

### FileCreated

> Alexusmai\LaravelFileManager\Events\FileCreated
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\FileCreated',
function ($event) {
\Log::info('FileCreated:', [
$event->disk(),
$event->path(),
$event->name(),
]);
}
);
```

### FileUpdate

> Alexusmai\LaravelFileManager\Events\FileUpdate
```php
\Event::listen('Alexusmai\LaravelFileManager\Events\FileUpdate',
function ($event) {
\Log::info('FileUpdate:', [
$event->disk(),
$event->path(),
]);
}
);
```
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* [Configuration](./configuration.md)
* [Integration](./integration.md)
* [ACL](./acl.md)
* [Events](./events.md)

## Requirements
* PHP >= 7.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Installation
# Installation
1. Install package - using composer

```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/integration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Integration
# Integration

> See examples in [examples](./../examples) folder
Expand Down
Loading

0 comments on commit aaeec4e

Please sign in to comment.