README.md in effective_storage-0.1.0 vs README.md in effective_storage-0.2.0
- old
+ new
@@ -59,17 +59,26 @@
## Permissions
The permissions you actually want to define are as follows (using CanCan):
```ruby
-can(:show, ActiveStorage::Attachment) { |attachment| attachment.permission_public? }
+# Allow anyone to download a public file
+can(:show, ActiveStorage::Blob) { |blob| blob.permission_public? }
if user.persisted?
end
if user.admin?
+ # This allows the admin to download any file
+ can :show, ActiveStorage::Blob
+
+ # Allows them to see the index screen
can :admin, :effective_storage
- can :index, ActiveStorage::Attachment
+ can :index, ActiveStorage::Blob
+
+ # Admin screen actions
+ can(:mark_inherited, ActiveStorage::Blob) { |blob| !blob.permission_inherited? }
+ can(:mark_public, ActiveStorage::Blob) { |blob| !blob.permission_public? }
end
```
## License