blob: b9dc12c7ff2c79ca12e5901aecd194c1d1c089fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
require 'couchrest'
module LEAP
class Users < CouchRest::Database
def initialize(server)
super(server, 'users')
end
def find_by_login(login)
record = self.view('User/by_login',
:reduce => false,
:startkey => login,
:endkey => login
)['rows'].first
if record
return self.get(record['id'])
end
end
def all_logins
self.view('User/by_login',
:reduce => false
)['rows'].map {|row|
row['key']
}
end
def all_active_ids
end
def all_ids
self.all_docs["rows"].map {|row| row["id"]}
end
end
end
|