repository-manager 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +1 -0
- data/README.md +17 -2
- data/lib/repository_manager/version.rb +1 -1
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/models/repository_spec.rb +4 -4
- metadata +1 -1
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
WORK ON PROGRESS,
|
1
|
+
WORK ON PROGRESS, but it works.
|
2
2
|
|
3
3
|
Ruby on Rails plugin (gem) for managing repositories (files/folders/permissions).
|
4
4
|
|
5
5
|
# RepositoryManager
|
6
6
|
|
7
|
-
This project is based on the need for a repository manager system for [Collaide](https://github.com/facenord-sud/collaide).
|
7
|
+
This project is based on the need for a repository manager system for [Collaide](https://github.com/facenord-sud/collaide). A system for easily create/delete files and folders in a repository. For share these repositories easily with other object with a flexible and complete authorisations management.
|
8
|
+
|
9
|
+
Instead of creating my core repository manager system heavily
|
8
10
|
dependent on our development, I'm trying to implement a generic and potent repository gem.
|
9
11
|
|
10
12
|
After looking for a good gem to use I noticed the lack of repository gems
|
@@ -169,6 +171,7 @@ user2.shares_repositories.all
|
|
169
171
|
|
170
172
|
|
171
173
|
If it has the authorisation, an object can add items to a share.
|
174
|
+
|
172
175
|
```ruby
|
173
176
|
# user1 want to add items to his share (the actions are done only if user1 has the ':can_add' permission)
|
174
177
|
user1.can_add_to_share(share) # => true
|
@@ -189,12 +192,14 @@ group2.can_remove_to_share(share) # => false
|
|
189
192
|
```
|
190
193
|
|
191
194
|
If it has the authorisation, an object can remove items from a share.
|
195
|
+
|
192
196
|
```ruby
|
193
197
|
# user1 want to remove group2 from this share
|
194
198
|
user1.removeItemsToShare(share, group2)
|
195
199
|
```
|
196
200
|
|
197
201
|
As admin, you can directly work with the share. Be carefull, there is NO authorisation verification !
|
202
|
+
|
198
203
|
```ruby
|
199
204
|
# Add an item to the share
|
200
205
|
share.addItems(item, share_permissions)
|
@@ -220,6 +225,7 @@ NOTICE : An object who can share a repository, can't set new permissions that it
|
|
220
225
|
For instance, `user3` has a share of `repository1` with `:can_delete => false` and `:can_share => true`. He can share `repository1` with `user4`, but he can't put `:can_delete => true` in this new share.
|
221
226
|
|
222
227
|
You can get all the authorisations with this method: `user1.get_authorisations(repository)`
|
228
|
+
|
223
229
|
```ruby
|
224
230
|
# Returns false if the object has no authorisation in this repository
|
225
231
|
# Returns true if the object has all the authorisations
|
@@ -242,6 +248,15 @@ To check if the object can add or remove an instance in the share, just write :
|
|
242
248
|
|
243
249
|
Like the repository authorisations, you can get the share authorisations with : `group1.get_share_authorisations(share)`.
|
244
250
|
|
251
|
+
## TODO
|
252
|
+
|
253
|
+
- Can dowload a file or a folder (auto zip the folder)
|
254
|
+
- Snapshot the file if possible
|
255
|
+
- Flexible configuration of authorised extensions
|
256
|
+
- Versioning
|
257
|
+
- ...
|
258
|
+
|
259
|
+
|
245
260
|
## License
|
246
261
|
|
247
262
|
This project rocks and uses MIT-LICENSE.
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -16,13 +16,13 @@ describe 'Repository' do
|
|
16
16
|
it 'can create a folder in it own folder' do
|
17
17
|
folder = @user1.createFolder('Folder1', @user1_folder)
|
18
18
|
|
19
|
-
expect(@user1_folder.has_children?).to eq(
|
19
|
+
expect(@user1_folder.has_children?).to eq(true)
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'can\'t create a folder in another folder without permission' do
|
23
23
|
folder = @user2.createFolder('Folder1', @user1_folder)
|
24
24
|
|
25
|
-
expect(@user1_folder.has_children?).to eq(
|
25
|
+
expect(@user1_folder.has_children?).to eq(false)
|
26
26
|
expect(folder).to eq(false)
|
27
27
|
end
|
28
28
|
|
@@ -30,14 +30,14 @@ describe 'Repository' do
|
|
30
30
|
file = FactoryGirl.build(:app_file)
|
31
31
|
theFile = @user1.createFile(file, @user1_folder)
|
32
32
|
|
33
|
-
expect(@user1_folder.has_children?).to eq(
|
33
|
+
expect(@user1_folder.has_children?).to eq(true)
|
34
34
|
expect(file).to eq(theFile)
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'can\'t create a repo into a file' do
|
38
38
|
file = @user2.createFolder('Folder1', @user1_file)
|
39
39
|
|
40
|
-
expect(@user1_file.has_children?).to eq(
|
40
|
+
expect(@user1_file.has_children?).to eq(false)
|
41
41
|
expect(file).to eq(false)
|
42
42
|
end
|
43
43
|
|