ixtlan-remote 0.1.7 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. metadata +2 -38
  2. data/lib/ixtlan/passwords.rb +0 -72
  3. data/lib/ixtlan/passwords.rb~ +0 -47
  4. data/lib/ixtlan/railtie.rb~ +0 -17
  5. data/lib/ixtlan/user_management/application_model.rb +0 -30
  6. data/lib/ixtlan/user_management/application_model.rb~ +0 -21
  7. data/lib/ixtlan/user_management/application_resource.rb +0 -48
  8. data/lib/ixtlan/user_management/application_resource.rb~ +0 -21
  9. data/lib/ixtlan/user_management/authentcator.rb~ +0 -31
  10. data/lib/ixtlan/user_management/authentication_model.rb +0 -31
  11. data/lib/ixtlan/user_management/authentication_model.rb~ +0 -21
  12. data/lib/ixtlan/user_management/authenticator.rb +0 -55
  13. data/lib/ixtlan/user_management/authenticator.rb~ +0 -20
  14. data/lib/ixtlan/user_management/domain_resource.rb +0 -78
  15. data/lib/ixtlan/user_management/domain_resource.rb~ +0 -21
  16. data/lib/ixtlan/user_management/dummy_authentication.rb +0 -70
  17. data/lib/ixtlan/user_management/dummy_authentication.rb~ +0 -49
  18. data/lib/ixtlan/user_management/group.rb~ +0 -39
  19. data/lib/ixtlan/user_management/group_model.rb +0 -31
  20. data/lib/ixtlan/user_management/group_model.rb~ +0 -21
  21. data/lib/ixtlan/user_management/models.rb~ +0 -39
  22. data/lib/ixtlan/user_management/session-serializer.rb~ +0 -18
  23. data/lib/ixtlan/user_management/session_cuba.rb +0 -67
  24. data/lib/ixtlan/user_management/session_cuba.rb~ +0 -44
  25. data/lib/ixtlan/user_management/session_manager.rb +0 -71
  26. data/lib/ixtlan/user_management/session_model.rb +0 -36
  27. data/lib/ixtlan/user_management/session_model.rb~ +0 -10
  28. data/lib/ixtlan/user_management/session_plugin.rb +0 -52
  29. data/lib/ixtlan/user_management/session_serializer.rb +0 -41
  30. data/lib/ixtlan/user_management/session_serializer.rb~ +0 -21
  31. data/lib/ixtlan/user_management/user.rb~ +0 -16
  32. data/lib/ixtlan/user_management/user_model.rb +0 -36
  33. data/lib/ixtlan/user_management/user_model.rb~ +0 -33
  34. data/lib/ixtlan/user_management/user_resource.rb +0 -55
  35. data/lib/ixtlan/user_management/user_resource.rb~ +0 -24
  36. data/lib/ixtlan/user_management/user_serializer.rb +0 -35
  37. data/lib/ixtlan/user_management/user_serializer.rb~ +0 -23
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: ixtlan-remote
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.7
5
+ version: 0.2.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christian Meier
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-09 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -180,42 +180,6 @@ extra_rdoc_files: []
180
180
  files:
181
181
  - lib/ixtlan-remote.rb
182
182
  - lib/ixtlan/remote.rb
183
- - lib/ixtlan/passwords.rb
184
- - lib/ixtlan/railtie.rb~
185
- - lib/ixtlan/passwords.rb~
186
- - lib/ixtlan/user_management/group_model.rb~
187
- - lib/ixtlan/user_management/application_model.rb~
188
- - lib/ixtlan/user_management/user_serializer.rb
189
- - lib/ixtlan/user_management/authenticator.rb
190
- - lib/ixtlan/user_management/dummy_authentication.rb
191
- - lib/ixtlan/user_management/authentcator.rb~
192
- - lib/ixtlan/user_management/user_model.rb
193
- - lib/ixtlan/user_management/session_serializer.rb
194
- - lib/ixtlan/user_management/application_resource.rb~
195
- - lib/ixtlan/user_management/session_model.rb~
196
- - lib/ixtlan/user_management/session_serializer.rb~
197
- - lib/ixtlan/user_management/models.rb~
198
- - lib/ixtlan/user_management/group_model.rb
199
- - lib/ixtlan/user_management/user_resource.rb
200
- - lib/ixtlan/user_management/session_manager.rb
201
- - lib/ixtlan/user_management/session_cuba.rb~
202
- - lib/ixtlan/user_management/session_plugin.rb
203
- - lib/ixtlan/user_management/session-serializer.rb~
204
- - lib/ixtlan/user_management/domain_resource.rb~
205
- - lib/ixtlan/user_management/application_resource.rb
206
- - lib/ixtlan/user_management/dummy_authentication.rb~
207
- - lib/ixtlan/user_management/domain_resource.rb
208
- - lib/ixtlan/user_management/group.rb~
209
- - lib/ixtlan/user_management/authentication_model.rb
210
- - lib/ixtlan/user_management/user.rb~
211
- - lib/ixtlan/user_management/user_resource.rb~
212
- - lib/ixtlan/user_management/session_model.rb
213
- - lib/ixtlan/user_management/user_serializer.rb~
214
- - lib/ixtlan/user_management/application_model.rb
215
- - lib/ixtlan/user_management/session_cuba.rb
216
- - lib/ixtlan/user_management/authentication_model.rb~
217
- - lib/ixtlan/user_management/authenticator.rb~
218
- - lib/ixtlan/user_management/user_model.rb~
219
183
  - lib/ixtlan/remote/summary.rb
220
184
  - lib/ixtlan/remote/server.rb~
221
185
  - lib/ixtlan/remote/access_controller.rb
@@ -1,72 +0,0 @@
1
- #
2
- # ixtlan-remote - helper sync data between miniapps or communicate wth realtime
3
- # rest-services
4
- # Copyright (C) 2013 Christian Meier
5
- #
6
- # This file is part of ixtlan-remote.
7
- #
8
- # ixtlan-remote is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU Affero General Public License as
10
- # published by the Free Software Foundation, either version 3 of the
11
- # License, or (at your option) any later version.
12
- #
13
- # ixtlan-remote is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU Affero General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Affero General Public License
19
- # along with ixtlan-remote. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- require 'yaml'
22
- require 'erb'
23
- module Ixtlan
24
- class HashWithDefault < ::Hash
25
- def get( key, default = HashWithDefault.new )
26
- self[ key ] || default
27
- end
28
- end
29
-
30
- class Passwords
31
-
32
- def self.symbolize_keys(h)
33
- result = HashWithDefault.new
34
-
35
- h.each do |k, v|
36
- v = ' ' if v.nil?
37
- if v.is_a?(Hash)
38
- result[k.to_sym] = symbolize_keys(v) unless v.size == 0
39
- else
40
- result[k.to_sym] = v unless k.to_sym == v.to_sym
41
- end
42
- end
43
- result
44
- end
45
-
46
- def self.load( file )
47
- rel_file = File.expand_path( file ).sub( /#{File.expand_path '.' }\/?/, '' )
48
- if File.exists?( file )
49
- warn "[Passwords] Loaded #{rel_file} file"
50
- symbolize_keys( YAML::load( ERB.new( IO.read( file ) ).result ) )
51
- else
52
- warn "[Passwords] No #{rel_file} file to load"
53
- end
54
- end
55
-
56
- def self.config( file = 'password.yml' )
57
- @config ||= load( file ) || HashWithDefault.new
58
- end
59
-
60
- def self.[]( key )
61
- @config[ key ]
62
- end
63
-
64
- def self.get( key, default = nil )
65
- if default
66
- @config.get( key, default )
67
- else
68
- @config.get( key )
69
- end
70
- end
71
- end
72
- end
@@ -1,47 +0,0 @@
1
- require 'yaml'
2
- require 'erb'
3
- module Ixtlan
4
- class Hash < ::Hash
5
- def get( key, default = {} )
6
- self[ key ] || default
7
- end
8
- end
9
-
10
- class Passwords
11
-
12
- def self.symbolize_keys(h)
13
- result = Hash.new
14
-
15
- h.each do |k, v|
16
- v = ' ' if v.nil?
17
- if v.is_a?(Hash)
18
- result[k.to_sym] = symbolize_keys(v) unless v.size == 0
19
- else
20
- result[k.to_sym] = v unless k.to_sym == v.to_sym
21
- end
22
- end
23
-
24
- result
25
- end
26
-
27
- def self.load( file )
28
- if File.exists?(file)
29
- symbolize_keys(YAML::load(ERB.new(IO.read(file)).result))
30
- else
31
- warn "no #{file} file to load"
32
- end
33
- end
34
-
35
- def self.config( file = 'password.yml' )
36
- @config ||= load( file ) || {}
37
- end
38
-
39
- def self.[]( key )
40
- @config[ key ]
41
- end
42
-
43
- def self.get( key )
44
- @config.get( key )
45
- end
46
- end
47
- end
@@ -1,17 +0,0 @@
1
- require 'ixtlan/remote/rest'
2
- require 'ixtlan/gettext/manager'
3
- module Ixtlan
4
- module Remote
5
-
6
- class Railtie < Rails::Railtie
7
-
8
- config.rest = Ixtlan::Remote::Rest.new
9
-
10
- config.gettext = Ixtlan::Gettext::Manager.new
11
-
12
- rake_tasks do
13
- load 'ixtlan/gettext/translation.rake'
14
- end
15
- end
16
- end
17
- end
@@ -1,30 +0,0 @@
1
- #
2
- # ixtlan-remote - helper sync data between miniapps or communicate wth realtime
3
- # rest-services
4
- # Copyright (C) 2012 Christian Meier
5
- #
6
- # This file is part of ixtlan-remote.
7
- #
8
- # ixtlan-remote is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU Affero General Public License as
10
- # published by the Free Software Foundation, either version 3 of the
11
- # License, or (at your option) any later version.
12
- #
13
- # ixtlan-remote is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU Affero General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Affero General Public License
19
- # along with ixtlan-remote. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- module Ixtlan
22
- module UserManagement
23
- class Application
24
- include Virtus
25
-
26
- attribute :name, String
27
- attribute :url, String
28
- end
29
- end
30
- end
@@ -1,21 +0,0 @@
1
- module Ixtlan
2
- module UserManagement
3
- class Application
4
- include Virtus
5
-
6
- attribute :name, String
7
- attribute :url, String
8
- end
9
- class Group
10
- include Virtus
11
-
12
- attribute :name, String
13
- end
14
- class Authentication
15
- include Virtus
16
-
17
- attribute :login, String
18
- attribute :password, String
19
- end
20
- end
21
- end
@@ -1,48 +0,0 @@
1
- #
2
- # ixtlan-remote - helper sync data between miniapps or communicate wth realtime
3
- # rest-services
4
- # Copyright (C) 2012 Christian Meier
5
- #
6
- # This file is part of ixtlan-remote.
7
- #
8
- # ixtlan-remote is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU Affero General Public License as
10
- # published by the Free Software Foundation, either version 3 of the
11
- # License, or (at your option) any later version.
12
- #
13
- # ixtlan-remote is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU Affero General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Affero General Public License
19
- # along with ixtlan-remote. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- module Ixtlan
22
- module UserManagement
23
- class Application
24
- include DataMapper::Resource
25
-
26
- def self.storage_name(arg)
27
- 'ixtlan_applications'
28
- end
29
-
30
- # key for selectng the IdentityMap should remain this class if
31
- # there is no single table inheritance with Discriminator in place
32
- # i.e. the subclass used as key for the IdentityMap
33
- def self.base_model
34
- self
35
- end
36
-
37
- property :id, Serial, :auto_validation => false
38
-
39
- property :name, String, :required => true, :unique => true, :length => 32
40
- property :url, String, :required => true, :format => /^https?\:\/\/[a-z0-9\-\.]+(\.[a-z0-9]+)*(\:[0-9]+)?(\/\S*)?$/, :length => 64, :lazy => true
41
- property :updated_at, DateTime, :required => true, :lazy => true
42
-
43
- # do not record timestamps since they are set from outside
44
- def set_timestamps_on_save
45
- end
46
- end
47
- end
48
- end
@@ -1,21 +0,0 @@
1
- module Ixtlan
2
- module UserManagement
3
- class Application
4
- include DataMapper::Resource
5
-
6
- def self.storage_name(arg)
7
- 'ixtlan_applications'
8
- end
9
-
10
- property :id, Serial, :auto_validation => false
11
-
12
- property :name, String, :required => true, :unique => true, :length => 32
13
- property :url, String, :required => true, :format => /^https?\:\/\/[a-z0-9\-\.]+(\.[a-z0-9]+)*(\:[0-9]+)?(\/\S*)?$/, :length => 64, :lazy => true
14
- property :updated_at, DateTime, :required => true, :lazy => true
15
-
16
- # do not record timestamps since they are set from outside
17
- def set_timestamps_on_save
18
- end
19
- end
20
- end
21
- end
@@ -1,31 +0,0 @@
1
- module Ixtlan
2
- module UserManagement
3
- class User
4
-
5
- include DataMapper::Resource
6
-
7
- def self.storage_name(arg)
8
- 'ixtlan_users'
9
- end
10
-
11
- # key for selectng the IdentityMap should remain this class if
12
- # there is no single table inheritance with Discriminator in place
13
- # i.e. the subclass used as key for the IdentityMap
14
- def self.base_model
15
- self
16
- end
17
-
18
- property :id, Serial, :auto_validation => false
19
-
20
- property :login, String, :required => true, :unique => true, :length => 32
21
- property :name, String, :required => true, :length => 128
22
- property :updated_at, DateTime, :required => true
23
-
24
- attr_accessor :groups, :applications
25
-
26
- # do not record timestamps since they are set from outside
27
- def set_timestamps_on_save
28
- end
29
- end
30
- end
31
- end
@@ -1,31 +0,0 @@
1
- #
2
- # ixtlan-remote - helper sync data between miniapps or communicate wth realtime
3
- # rest-services
4
- # Copyright (C) 2012 Christian Meier
5
- #
6
- # This file is part of ixtlan-remote.
7
- #
8
- # ixtlan-remote is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU Affero General Public License as
10
- # published by the Free Software Foundation, either version 3 of the
11
- # License, or (at your option) any later version.
12
- #
13
- # ixtlan-remote is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU Affero General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Affero General Public License
19
- # along with ixtlan-remote. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- require 'virtus'
22
- module Ixtlan
23
- module UserManagement
24
- class Authentication
25
- include Virtus
26
-
27
- attribute :login, String
28
- attribute :password, String
29
- end
30
- end
31
- end
@@ -1,21 +0,0 @@
1
- module Ixtlan
2
- module UserManagement
3
- class Application
4
- include Virtus
5
-
6
- attribute :name, String
7
- attribute :url, String
8
- end
9
- class Group
10
- include Virtus
11
-
12
- attribute :name, String
13
- end
14
- class Authentication
15
- include Virtus
16
-
17
- attribute :login, String
18
- attribute :password, String
19
- end
20
- end
21
- end
@@ -1,55 +0,0 @@
1
- #
2
- # ixtlan-remote - helper sync data between miniapps or communicate wth realtime
3
- # rest-services
4
- # Copyright (C) 2012 Christian Meier
5
- #
6
- # This file is part of ixtlan-remote.
7
- #
8
- # ixtlan-remote is free software: you can redistribute it and/or modify
9
- # it under the terms of the GNU Affero General Public License as
10
- # published by the Free Software Foundation, either version 3 of the
11
- # License, or (at your option) any later version.
12
- #
13
- # ixtlan-remote is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU Affero General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU Affero General Public License
19
- # along with ixtlan-remote. If not, see <http://www.gnu.org/licenses/>.
20
- #
21
- require 'ixtlan/user_management/authentication_model'
22
- module Ixtlan
23
- module UserManagement
24
- class Authenticator
25
-
26
- def initialize( restserver )
27
- @restserver = restserver
28
- end
29
-
30
- def user_new( params )
31
- User.new( params )
32
- end
33
-
34
- def login( username_or_email, password )
35
- user = nil
36
- @restserver.create( Authentication.new(:login => username_or_email, :password => password) ) do |json, req|
37
- user = user_new( JSON.load( json ) ) unless json.strip == ''
38
- nil
39
- end
40
- user
41
- end
42
-
43
- def reset_password( username_or_email )
44
- result = nil
45
- @restserver.create( Authentication.new( :login => username_or_email ),
46
- :reset_password ) do |json, req|
47
- result = json unless json.strip == ''
48
- #tell restserver to ignore response
49
- nil
50
- end
51
- result
52
- end
53
- end
54
- end
55
- end