Module: Amp::Servers::RepoUserManagement::DataMapper
- Defined in:
- lib/amp/server/repo_user_management.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#add_user(user_info = {}) ⇒ Object
(also: #<<)
Adds a user to the system.
-
#repos ⇒ Object
All the repositories stored in a hash.
-
#set_private(repository, _private = true) ⇒ Object
Sets the given repository’s privacy levels.
-
#set_reader(repository, user) ⇒ Object
Adds a given username/password combination to the system, for a given repository, with read-only privileges.
-
#set_writer(repository, user) ⇒ Object
Adds a given username/password combination to the system, for a given repository, with write privileges.
- #users ⇒ Object
Class Method Details
.extended(klass) ⇒ Object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/amp/server/repo_user_management.rb', line 190 def self.extended(klass) require 'dm-core' users = Class.new do include DataMapper::Resource property :username, String property :password, String has n, :perms end const_set 'User', users perms = Class.new do include DataMapper::Resource property :read property :write belongs_to :user belongs_to :repo end const_set 'Perm', perms repo = Class.new do include DataMapper::Resource property :url, String property :path, String has n, :perms end const_set 'Repo', repo end |
Instance Method Details
#add_user(user_info = {}) ⇒ Object Also known as: <<
Adds a user to the system. This is not repository specific.
243 244 245 |
# File 'lib/amp/server/repo_user_management.rb', line 243 def add_user(user_info={}) end |
#repos ⇒ Object
slow as fuck
All the repositories stored in a hash.
:private => Boolean}
229 230 231 |
# File 'lib/amp/server/repo_user_management.rb', line 229 def repos end |
#set_private(repository, _private = true) ⇒ Object
don’t know if this actually works
Sets the given repository’s privacy levels. Repositories default to being public, and must be set to be private using this method. This method can also be used to later make a private repository public without stopping the server.
280 281 282 |
# File 'lib/amp/server/repo_user_management.rb', line 280 def set_private(repository, _private=true) end |
#set_reader(repository, user) ⇒ Object
don’t know if this actually works
Adds a given username/password combination to the system, for a given repository, with read-only privileges. This will override any other settings previously set. For example, a call to #set_writer and then #set_reader would be as though #set_writer never happened.
268 269 270 |
# File 'lib/amp/server/repo_user_management.rb', line 268 def set_reader(repository, user) end |
#set_writer(repository, user) ⇒ Object
don’t know if this actually works
Adds a given username/password combination to the system, for a given repository, with write privileges.
255 256 257 |
# File 'lib/amp/server/repo_user_management.rb', line 255 def set_writer(repository, user) end |
#users ⇒ Object
233 234 235 |
# File 'lib/amp/server/repo_user_management.rb', line 233 def users end |