repository-manager 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/Gemfile.lock +9 -12
  2. data/README.md +152 -115
  3. data/app/models/{app_file.rb → repo_file.rb} +3 -3
  4. data/app/models/repo_folder.rb +60 -0
  5. data/app/models/{repository.rb → repo_item.rb} +10 -10
  6. data/app/models/sharing.rb +58 -0
  7. data/app/models/sharings_member.rb +6 -0
  8. data/app/uploaders/{repository_uploader.rb → repo_file_uploader.rb} +1 -1
  9. data/db/migrate/20131018214212_create_repository_manager.rb +9 -17
  10. data/lib/generators/repository_manager/install_generator.rb +1 -3
  11. data/lib/generators/repository_manager/templates/initializer.rb +5 -10
  12. data/lib/repository-manager.rb +4 -4
  13. data/lib/repository_manager/engine.rb +0 -1
  14. data/lib/repository_manager/has_repository.rb +140 -129
  15. data/lib/repository_manager/version.rb +1 -1
  16. data/repository-manager.gemspec +4 -5
  17. data/spec/dummy/config/locales/en.yml +1 -8
  18. data/spec/dummy/db/development.sqlite3 +0 -0
  19. data/spec/dummy/db/migrate/20131016193722_create_users.rb +11 -11
  20. data/spec/dummy/db/migrate/20131016193834_create_groups.rb +10 -10
  21. data/spec/dummy/db/migrate/20131016194207_create_groups_users.rb +5 -5
  22. data/spec/dummy/db/migrate/20131018214212_create_repository_manager.rb +9 -17
  23. data/spec/dummy/db/schema.rb +16 -16
  24. data/spec/dummy/db/test.sqlite3 +0 -0
  25. data/spec/factories/{app_file.rb → repo_file.rb} +1 -1
  26. data/spec/factories/{folder.rb → repo_folder.rb} +1 -1
  27. data/spec/has_repository_spec.rb +107 -107
  28. data/spec/models/associations_spec.rb +45 -45
  29. data/spec/models/repository_spec.rb +51 -27
  30. data/spec/models/share_spec.rb +39 -39
  31. metadata +15 -37
  32. data/app/models/folder.rb +0 -54
  33. data/app/models/share.rb +0 -58
  34. data/app/models/shares_item.rb +0 -10
  35. data/db/migrate/20131025085844_add_file_to_repositories.rb +0 -8
  36. data/db/migrate/20131025085845_add_file_to_files.rb +0 -5
  37. data/spec/dummy/db/migrate/20131025085844_add_file_to_repositories.rb +0 -8
  38. data/spec/dummy/db/migrate/20131025085845_add_file_to_files.rb +0 -5
@@ -1,19 +1,10 @@
1
1
  class CreateRepositoryManager < ActiveRecord::Migration
2
2
 
3
3
  def change
4
- #create_table :permissions do |t|
5
- # t.boolean :can_create, :default => false
6
- # t.boolean :can_read, :default => false
7
- # t.boolean :can_update, :default => false
8
- # t.boolean :can_delete, :default => false
9
- # t.boolean :can_share, :default => false
10
- #end
11
4
 
12
- create_table :shares do |t|
13
- #t.integer :permission_id
14
- #t.integer :user_id
5
+ create_table :sharings do |t|
15
6
  t.references :owner, polymorphic: true
16
- t.integer :repository_id
7
+ t.references :repo_item
17
8
  t.boolean :can_create, :default => false
18
9
  t.boolean :can_read, :default => false
19
10
  t.boolean :can_update, :default => false
@@ -21,19 +12,20 @@ class CreateRepositoryManager < ActiveRecord::Migration
21
12
  t.boolean :can_share, :default => false
22
13
  end
23
14
 
24
- create_table :shares_items do |t|
25
- t.integer :share_id
26
- #t.integer :item_type
27
- #t.integer :item_id
28
- t.references :item, polymorphic: true
15
+ create_table :sharings_members do |t|
16
+ t.references :sharing
17
+ t.references :member, polymorphic: true
29
18
  t.boolean :can_add, :default => false
30
19
  t.boolean :can_remove, :default => false
31
20
  end
32
21
 
33
- create_table :repositories do |t|
22
+ create_table :repo_items do |t|
34
23
  t.references :owner, polymorphic: true
35
24
  t.string :ancestry
36
25
  t.string :name
26
+ t.float :file_size
27
+ t.string :content_type
28
+ t.string :file
37
29
  t.string :type
38
30
  end
39
31
  end
@@ -23,9 +23,7 @@ module RepositoryManager #:nodoc:
23
23
  #end
24
24
 
25
25
  def copy_migrations
26
- migrations = [["20131018214212_create_repository_manager.rb","create_repository_manager.rb"],
27
- ["20131025085844_add_file_to_repositories.rb","add_file_to_repositories.rb"],
28
- ["20131025085845_add_file_to_files", "add_file_to_files.rb"]
26
+ migrations = [["20131018214212_create_repository_manager.rb","create_repository_manager.rb"]
29
27
  ]
30
28
  migrations.each do |migration|
31
29
  migration_template "../../../../db/migrate/" + migration[0], "db/migrate/" + migration[1]
@@ -1,13 +1,8 @@
1
1
  RepositoryManager.setup do |config|
2
2
 
3
- # Default repository permissions that an object has on the repository after a share.
4
- config.default_repo_permissions = { can_read: true, can_create: false, can_update:false, can_delete:false, can_share: false }
3
+ # Default repo_item permissions that an object has on the repo_item after a sharing.
4
+ config.default_repo_item_permissions = { can_read: true, can_create: false, can_update:false, can_delete:false, can_share: false }
5
5
 
6
- # Default share permissions thant an object has when he is added in a share.
7
- config.default_share_permissions = { can_add: false, can_remove: false }
8
- end
9
-
10
- #Rails.application.configure do
11
- # # Uncomment this to turn on verbose mode
12
- # # config.my_gem.verbose = true
13
- #end
6
+ # Default sharing permissions that an object has when he is added in a sharing.
7
+ config.default_sharing_permissions = { can_add: false, can_remove: false }
8
+ end
@@ -2,11 +2,11 @@ require 'repository_manager/has_repository'
2
2
 
3
3
  module RepositoryManager
4
4
 
5
- mattr_accessor :default_repo_permissions
6
- @@default_repo_permissions = { can_read: true, can_create: false, can_update:false, can_delete:false, can_share: false }
5
+ mattr_accessor :default_repo_item_permissions
6
+ @@default_repo_item_permissions = { can_read: true, can_create: false, can_update:false, can_delete:false, can_share: false }
7
7
 
8
- mattr_accessor :default_share_permissions
9
- @@default_share_permissions = { can_add: false, can_remove: false }
8
+ mattr_accessor :default_sharing_permissions
9
+ @@default_sharing_permissions = { can_add: false, can_remove: false }
10
10
 
11
11
  class << self
12
12
  def setup
@@ -1,6 +1,5 @@
1
1
  require 'ancestry'
2
2
  require 'carrierwave'
3
- require 'enumerize'
4
3
 
5
4
  module RepositoryManager
6
5
  class Engine < ::Rails::Engine
@@ -2,25 +2,22 @@ module RepositoryManager
2
2
  module HasRepository
3
3
  extend ActiveSupport::Concern
4
4
 
5
- included do
6
- end
7
-
8
5
  module ClassMethods
9
6
  def has_repository(options = {})
10
7
 
11
- has_many :shares, through: :shares_items, dependent: :destroy
12
- has_many :shares_items, as: :item, dependent: :destroy
13
- has_many :shares_owners, as: :owner, class_name: 'Share'
8
+ has_many :sharings, through: :sharings_members
9
+ has_many :sharings_members, as: :member, dependent: :destroy
10
+ has_many :sharings_owners, as: :owner, class_name: 'Sharing'
14
11
 
15
- # The own repositories
16
- has_many :repositories, as: :owner #, dependent: :destroy
17
- # The share repositories
18
- has_many :shared_repositories, through: :shares, source: :repository, class_name: 'Repository'
12
+ # The own repo_items
13
+ has_many :repo_items, as: :owner #, dependent: :destroy
14
+ # The sharing repo_items
15
+ has_many :shared_repo_items, through: :sharings, source: :repo_item, class_name: 'RepoItem'
19
16
 
20
- #scope :all_repositories, -> { self.repositories.shared_repositories }
17
+ #scope :all_repo_items, -> { self.repo_items.shared_repo_items }
21
18
 
22
- #All repositories (own and shares)
23
- #has_many :all_repositories
19
+ #All repo_items (own and sharings)
20
+ #has_many :all_repo_items
24
21
 
25
22
  include RepositoryManager::HasRepository::LocalInstanceMethods
26
23
  end
@@ -28,44 +25,45 @@ module RepositoryManager
28
25
 
29
26
  module LocalInstanceMethods
30
27
 
31
- # Share the repository with the items, with the options
32
- # options[:repo_permissions] contains :
33
- # <tt>:can_read</tt> - Item can download the repository
34
- # <tt>:can_create</tt> - Item can create a new repository on it
35
- # <tt>:can_edit</tt> - Item can edit the repository
36
- # <tt>:can_delete</tt> - Item can delete the repository
37
- # <tt>:can_share</tt> - Item can share the repository
38
- # options[:share_permissions] contains :
39
- # <tt>:can_add</tt> - Specify if the item can add objects to the share
40
- # <tt>:can_remove</tt> - Specify if the item can remove object to the share
41
- def share(repository, items, options = nil)
42
- authorisations = get_authorisations(repository)
43
-
44
- # Here we look if the instance has the authorisation for making a share
28
+ # Sharing the repo_item with the members, with the options
29
+ # options[:repo_item_permissions] contains :
30
+ # <tt>:can_read</tt> - Member can download the repo_item
31
+ # <tt>:can_create</tt> - Member can create a new repo_item on it
32
+ # <tt>:can_edit</tt> - Member can edit the repo_item
33
+ # <tt>:can_delete</tt> - Member can delete the repo_item
34
+ # <tt>:can_share</tt> - Member can share the repo_item
35
+ # options[:sharing_permissions] contains :
36
+ # <tt>:can_add</tt> - Specify if the member can add objects to the sharing
37
+ # <tt>:can_remove</tt> - Specify if the member can remove object to the sharing
38
+ def share(repo_item, members, options = nil)
39
+ authorisations = get_authorisations(repo_item)
40
+
41
+ # Here we look if the instance has the authorisation for making a sharing
45
42
  if can_share?(nil, authorisations)
46
43
 
47
44
  # We put the default options
48
- repo_permissions = RepositoryManager.default_repo_permissions
49
- share_permissions = RepositoryManager.default_share_permissions
45
+ repo_item_permissions = RepositoryManager.default_repo_item_permissions
46
+ sharing_permissions = RepositoryManager.default_sharing_permissions
50
47
 
51
48
  # If there is options, we have to take it
52
49
  if options
53
- repo_permissions = options[:repo_permissions] if options[:repo_permissions]
54
- share_permissions = options[:share_permissions] if options[:share_permissions]
50
+ repo_item_permissions = options[:repo_item_permissions] if options[:repo_item_permissions]
51
+ sharing_permissions = options[:sharing_permissions] if options[:sharing_permissions]
55
52
  end
56
53
 
57
- repo_permissions = make_repo_permissions(repo_permissions, authorisations)
54
+ repo_item_permissions = make_repo_item_permissions(repo_item_permissions, authorisations)
58
55
 
59
- share = Share.new(repo_permissions)
60
- share.owner = self
56
+ sharing = Sharing.new(repo_item_permissions)
57
+ sharing.owner = self
61
58
 
62
- share.add_items(items, share_permissions)
59
+ sharing.add_members(members, sharing_permissions)
63
60
 
64
- repository.shares << share
65
- repository.save
66
- share
61
+ repo_item.sharings << sharing
62
+ repo_item.save
63
+ sharing
67
64
  else
68
- # No permission => No share
65
+ # No permission => No sharing
66
+ #raise "sharing failed. You don't have the permission to share the repo_item '#{repo_item.name}'"
69
67
  false
70
68
  end
71
69
  end
@@ -77,57 +75,64 @@ module RepositoryManager
77
75
  # If he want to create a folder in a directory, we have to check if he have the authorisation
78
76
  if can_create?(source_folder)
79
77
 
80
- folder = Folder.new(name: name)
78
+ folder = RepoFolder.new(name: name)
81
79
  folder.owner = self
82
80
  folder.save
83
81
 
84
- # If we want to create a folder in a folder, we have to check if we have the authorisation
85
- if source_folder
86
- source_folder.add_repository(folder)
82
+ # We have to look if it is ok to add the folder here
83
+ if source_folder == nil || source_folder.add(folder)
84
+ folder
85
+ else
86
+ # The add didn't works, we delete the folder
87
+ folder.destroy
88
+ #raise "create_folder failed. The folder '#{name}' already exist in folder '#{source_folder.name}'"
89
+ false
87
90
  end
88
-
89
- return folder
90
91
  else
92
+ #raise "create_folder failed. You don't have the permission to create a folder in '#{source_folder.name}'"
91
93
  return false
92
94
  end
93
95
  end
94
96
 
95
- # Delete the repository
96
- def delete_repository(repository)
97
- if can_delete?(repository)
98
- repository.destroy
97
+ # Delete the repo_item
98
+ def delete_repo_item(repo_item)
99
+ if can_delete?(repo_item)
100
+ repo_item.destroy
99
101
  else
102
+ #raise "delete_repo_item failed. You don't have the permission to delete the repo_item '#{repo_item.name}'"
100
103
  return false
101
104
  end
102
105
  end
103
106
 
104
107
  # Create the file (file) in the directory (source_folder)
105
- # Param file can be a File, or a instance of AppFile
108
+ # Param file can be a File, or a instance of RepoFile
106
109
  # Return the object of the file created if it is ok
107
110
  # Return false if the file is not created (no authorisation)
108
111
  def create_file(file, source_folder = nil)
109
112
  # If he want to create a file in a directory, we have to check if he have the authorisation
110
113
  if can_create?(source_folder)
111
114
  if file.class.name == 'File'
112
- app_file = AppFile.new
113
- app_file.file = file
114
- app_file.owner = self
115
- app_file.save
116
- elsif file.class.name == 'AppFile'
117
- app_file = file
118
- app_file.owner = self
119
- app_file.save
120
- else
121
- return false
115
+ repo_file = RepoFile.new
116
+ repo_file.file = file
117
+ repo_file.owner = self
118
+ repo_file.save
119
+ elsif file.class.name == 'RepoFile'
120
+ repo_file = file
121
+ repo_file.owner = self
122
+ repo_file.save
122
123
  end
123
124
 
124
- # Add the file into the source_folder
125
- if source_folder
126
- source_folder.add_repository(file)
125
+ # We have to look if it is ok to add the file here
126
+ if source_folder == nil || source_folder.add(file)
127
+ return repo_file
128
+ else
129
+ # The add didn't works, we delete the file
130
+ file.destroy
131
+ #raise "create_file failed. The file '#{name}' already exist in folder '#{source_folder.name}'"
132
+ return false
127
133
  end
128
-
129
- return app_file
130
134
  else
135
+ #raise "create_file failed. You don't have the permission to create a file in the folder '#{source_folder.name}'"
131
136
  return false
132
137
  end
133
138
  end
@@ -136,25 +141,25 @@ module RepositoryManager
136
141
  # Return false if the entity has not the authorisation to share this rep
137
142
  # Return true if the entity can share this rep with all the authorisations
138
143
  # Return an Array if the entity can share but with restriction
139
- # Return true if the repository is nil (he as all authorisations on his own rep)
140
- def get_authorisations(repository = nil)
141
- # If repository is nil, he can do what he want
142
- return true if repository == nil
144
+ # Return true if the repo_item is nil (he as all authorisations on his own rep)
145
+ def get_authorisations(repo_item = nil)
146
+ # If repo_item is nil, he can do what he want
147
+ return true if repo_item == nil
143
148
 
144
- # If the item is the owner, he can do what he want !
145
- if repository.owner == self
149
+ # If the member is the owner, he can do what he want !
150
+ if repo_item.owner == self
146
151
  # You can do what ever you want :)
147
152
  return true
148
- # Find if a share of this rep exist for the self instance
149
- elsif s = self.shares.where(repository_id: repository.id).first
150
- # Ok, give an array with the permission of the actual share
153
+ # Find if a sharing of this rep exist for the self instance
154
+ elsif s = self.sharings.where(repo_item_id: repo_item.id).first
155
+ # Ok, give an array with the permission of the actual sharing
151
156
  # (we can't share with more permission then we have)
152
157
  return {can_share: s.can_share, can_read: s.can_read, can_create: s.can_create, can_update: s.can_update, can_delete: s.can_delete}
153
158
  else
154
- # We look at the ancestor if there is a share
155
- ancestor_ids = repository.ancestor_ids
156
- # Check the nearest share if it exist
157
- if s = self.shares.where(repository_id: ancestor_ids).last
159
+ # We look at the ancestor if there is a sharing
160
+ ancestor_ids = repo_item.ancestor_ids
161
+ # Check the nearest sharing if it exist
162
+ if s = self.sharings.where(repo_item_id: ancestor_ids).last
158
163
  return {can_share: s.can_share, can_read: s.can_read, can_create: s.can_create, can_update: s.can_update, can_delete: s.can_delete}
159
164
  end
160
165
  end
@@ -162,93 +167,96 @@ module RepositoryManager
162
167
  return false
163
168
  end
164
169
 
165
- # Download a repository if the object can_read it
170
+ # Download a repo_item if the object can_read it
166
171
  # If it is a file, he download the file
167
- # If it is a folder, we check witch repository is in it, and witch he can_read
172
+ # If it is a folder, we check witch repo_item is in it, and witch he can_read
168
173
  # We zip all the content that the object has access.
169
- def download(repository)
170
- if can_download?(repository)
171
- repository.download(self)
174
+ def download(repo_item)
175
+ if can_download?(repo_item)
176
+ repo_item.download(self)
172
177
  else
178
+ #raise "download failed. You don't have the permission to download the repo_item '#{repo_item.name}'"
173
179
  false
174
180
  end
175
181
  end
176
182
 
177
- #Return the authorisations of the share (can_add, can_remove)
178
- def get_share_authorisations(share)
179
- share.get_authorisations(self)
183
+ #Return the authorisations of the sharing (can_add, can_remove)
184
+ def get_sharing_authorisations(sharing)
185
+ sharing.get_authorisations(self)
180
186
  end
181
187
 
182
188
  # Return true if you can share the repo, else false
183
- # You can give the authorisations or the repository as params
184
- def can_share?(repository, authorisations = nil)
185
- can_do?('share', repository, authorisations)
189
+ # You can give the authorisations or the repo_item as params
190
+ def can_share?(repo_item, authorisations = nil)
191
+ can_do?('share', repo_item, authorisations)
186
192
  end
187
193
 
188
194
  # Return true if you can read the repo, else false
189
- def can_read?(repository, authorisations = nil)
190
- can_do?('read', repository, authorisations)
195
+ def can_read?(repo_item, authorisations = nil)
196
+ can_do?('read', repo_item, authorisations)
191
197
  end
192
198
 
193
199
  # Return true if you can download the repo, else false
194
200
  # Read = Download for the moment
195
- def can_download?(repository, authorisations = nil)
196
- can_do?('read', repository, authorisations)
201
+ def can_download?(repo_item, authorisations = nil)
202
+ can_do?('read', repo_item, authorisations)
197
203
  end
198
204
 
199
205
  # Return true if you can create in the repo, false else
200
- def can_create?(repository, authorisations = nil)
201
- can_do?('create', repository, authorisations)
206
+ def can_create?(repo_item, authorisations = nil)
207
+ can_do?('create', repo_item, authorisations)
202
208
  end
203
209
 
204
210
  # Return true if you can edit the repo, false else
205
- def can_update?(repository, authorisations = nil)
206
- can_do?('update', repository, authorisations)
211
+ def can_update?(repo_item, authorisations = nil)
212
+ can_do?('update', repo_item, authorisations)
207
213
  end
208
214
 
209
215
  # Return true if you can delete the repo, false else
210
- def can_delete?(repository, authorisations = nil)
211
- can_do?('delete', repository, authorisations)
216
+ def can_delete?(repo_item, authorisations = nil)
217
+ can_do?('delete', repo_item, authorisations)
212
218
  end
213
219
 
214
- # Return true if you can add an item in this share, false else
215
- def can_add_to?(share)
216
- can_do_to?('add', share)
220
+ # Return true if you can add a member in this sharing, false else
221
+ def can_add_to?(sharing)
222
+ can_do_to?('add', sharing)
217
223
  end
218
224
 
219
- # Return true if you can remove an item in this share, false else
220
- def can_remove_from?(share)
221
- can_do_to?('remove', share)
225
+ # Return true if you can remove a member in this sharing, false else
226
+ def can_remove_from?(sharing)
227
+ can_do_to?('remove', sharing)
222
228
  end
223
229
 
224
- # You can here add new items in the share
225
- # Param item could be an object or an array of object
226
- def add_items_to(share, items, options = nil)
227
- authorisations = get_share_authorisations(share)
228
- if can_add_to?(share)
229
- share_permissions = make_share_permissions(options, authorisations)
230
- share.add_items(items, share_permissions)
230
+ # You can here add new members in the sharing
231
+ # Param member could be an object or an array of object
232
+ def add_members_to(sharing, members, options = nil)
233
+ authorisations = get_sharing_authorisations(sharing)
234
+ if can_add_to?(sharing)
235
+ sharing_permissions = make_sharing_permissions(options, authorisations)
236
+ sharing.add_members(members, sharing_permissions)
231
237
  else
238
+ #raise "add members failed. You don't have the permission to add a member in this sharing"
232
239
  return false
233
240
  end
234
241
  end
235
242
 
236
- # You can here add new items in the share
237
- # Param item could be an object or an array of object
238
- def remove_items_from(share, items)
239
- if can_remove_from?(share)
240
- share.remove_items(items)
243
+ # You can here add new members in the sharing
244
+ # Param member could be an object or an array of object
245
+ def remove_members_from(sharing, members)
246
+ if can_remove_from?(sharing)
247
+ sharing.remove_members(members)
241
248
  else
249
+ #raise "remove members failed. You don't have the permission to remove a member on this sharing"
242
250
  return false
243
251
  end
244
252
  end
245
253
 
246
254
  private
247
255
 
248
- # Return if you can do or not this action in the share
249
- def can_do_to?(what, share, authorisations = nil)
256
+ # Return if you can do or not this action in the sharing
257
+ def can_do_to?(what, sharing, authorisations = nil)
250
258
  if authorisations == nil
251
- authorisations = share.get_authorisations(self)
259
+ authorisations = sharing.get_authorisations(self)
252
260
  end
253
261
  case what
254
262
  when 'add'
@@ -259,10 +267,10 @@ module RepositoryManager
259
267
  end
260
268
 
261
269
  # Return if you can do or not this action (what)
262
- def can_do?(what, repository, authorisations = nil)
270
+ def can_do?(what, repo_item, authorisations = nil)
263
271
  #If we pass no authorisations we have to get it
264
272
  if authorisations === nil
265
- authorisations = get_authorisations(repository)
273
+ authorisations = get_authorisations(repo_item)
266
274
  end
267
275
 
268
276
  case what
@@ -282,12 +290,12 @@ module RepositoryManager
282
290
 
283
291
  end
284
292
 
285
- # Correct the repo_permissions with the authorisations
286
- def make_repo_permissions(wanted_permissions, authorisations)
293
+ # Correct the repo_item_permissions with the authorisations
294
+ def make_repo_item_permissions(wanted_permissions, authorisations)
287
295
  # If it is an array, we have restriction in the permissions
288
296
  if authorisations.kind_of?(Hash) && wanted_permissions
289
- # Built the share with the accepted permissions
290
- # We remove the permission if we can't share it
297
+ # Built the sharing with the accepted permissions
298
+ # We remove the permission if we can't sharing it
291
299
  if wanted_permissions[:can_read] == true && authorisations[:can_read] == false
292
300
  wanted_permissions[:can_read] = false
293
301
  end
@@ -300,15 +308,18 @@ module RepositoryManager
300
308
  if wanted_permissions[:can_delete] == true && authorisations[:can_delete] == false
301
309
  wanted_permissions[:can_delete] = false
302
310
  end
311
+ if wanted_permissions[:can_share] == true && authorisations[:can_share] == false
312
+ wanted_permissions[:can_share] = false
313
+ end
303
314
  end
304
315
  return wanted_permissions
305
316
  end
306
317
 
307
- # Correct the share_permissions with the authorisations
308
- def make_share_permissions(wanted_permissions, authorisations)
318
+ # Correct the sharing_permissions with the authorisations
319
+ def make_sharing_permissions(wanted_permissions, authorisations)
309
320
  # If it is an array, we have restriction in the permissions
310
321
  if authorisations.kind_of?(Hash) && wanted_permissions
311
- # Built the share with the accepted permissions
322
+ # Built the sharing with the accepted permissions
312
323
  # We remove the permission if we can't share it
313
324
  if wanted_permissions[:can_add] == true && authorisations[:can_add] == false
314
325
  wanted_permissions[:can_add] = false
@@ -1,3 +1,3 @@
1
1
  module RepositoryManager
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Yves Baumann']
11
11
  s.email = ['texicitys@gmail.com']
12
12
  s.homepage = 'https://github.com/Texicitys/repository-manager'
13
- s.summary = "Ruby on Rails plugin (gem) for managing repositories (files/folders/permissions/shares)."
14
- s.description = "This project is based on the need for a repository manager system for 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.
15
- Each instance (users, groups, etc..) can have it own repositories (with files and folders). It can manage them easily (edit, remove, add, etc) and share them with other instance."
13
+ s.summary = "Ruby on Rails plugin (gem) for managing repositories (files/folders/permissions/sharings)."
14
+ s.description = "This project is based on the need for a repository manager system for Collaide. A system for easily create/delete files and folders in a repository. For sharing these repositories easily with other object with a flexible and complete authorisations management.
15
+ Each instance (users, groups, etc..) can have it own repositories (with files and folders). It can manage them easily (edit, remove, add, etc) and sharing them with other instance."
16
16
 
17
17
  #s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.md"]
18
18
  s.files = `git ls-files`.split("\n")
@@ -27,6 +27,5 @@ Each instance (users, groups, etc..) can have it own repositories (with files an
27
27
  s.add_development_dependency 'rspec-rails', '~> 2.0'
28
28
  s.add_runtime_dependency 'ancestry'
29
29
  s.add_runtime_dependency 'carrierwave'
30
- s.add_runtime_dependency 'enumerize'
31
- s.add_runtime_dependency 'rubyzip'
30
+ s.add_runtime_dependency 'rubyzip'#, '< 1.0.0'#, :require => 'zip/zip'
32
31
  end
@@ -1,11 +1,4 @@
1
- en:
2
- enumerize:
3
- repository:
4
- type:
5
- file: "File"
6
- directory: "Directory"
7
-
8
- # Files in the config/locales directory are used for internationalization
1
+ # Files in the config/locales directory are used for internationalization
9
2
  # and are automatically loaded by Rails. If you want to use locales other
10
3
  # than English, add the necessary files in this directory.
11
4
  #
Binary file
@@ -1,11 +1,11 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table :users do |t|
4
- t.string :nickname
5
- t.string :password
6
- t.string :email
7
-
8
- t.timestamps
9
- end
10
- end
11
- end
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+ t.string :nickname
5
+ t.string :password
6
+ t.string :email
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -1,10 +1,10 @@
1
- class CreateGroups < ActiveRecord::Migration
2
- def change
3
- create_table :groups do |t|
4
- t.string :name
5
- t.text :description
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
1
+ class CreateGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :groups do |t|
4
+ t.string :name
5
+ t.text :description
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,5 @@
1
- class CreateGroupsUsers < ActiveRecord::Migration
2
- def change
3
- create_join_table :groups, :users
4
- end
5
- end
1
+ class CreateGroupsUsers < ActiveRecord::Migration
2
+ def change
3
+ create_join_table :groups, :users
4
+ end
5
+ end