egov_utils 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/attributes/egov_utils/fullname.rb +15 -0
- data/app/controllers/egov_utils/sessions_controller.rb +1 -1
- data/app/models/ability.rb +3 -3
- data/app/models/egov_utils/person.rb +3 -0
- data/app/schemas/egov_utils/person_schema.rb +15 -0
- data/app/views/common/_grid.html.coffee +2 -1
- data/config/locales/cs.yml +3 -0
- data/lib/egov_utils/auth_source.rb +8 -8
- data/lib/egov_utils/version.rb +1 -1
- metadata +4 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f63fa0be85c1b24f142e25d3ba88b06aa28746c
|
4
|
+
data.tar.gz: f591df909e11cc230e68a12c51a2a8324db9dd9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54147634748dbca9e1c632fb0a7be76663a5b7295e14180d26d9eaa99926a4f953ee063132ad29da18b1e64c4c1edae46e25df6e193f181b728c571edbc05581
|
7
|
+
data.tar.gz: 36ef6a4509dd5173c9027c4585341a33701992bf1ba7df49fd4371de8baf8d6a401d0557e648bafc926d1e13de344bb45002dae4a3ad5d7c30c30f67efcf9ed1
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class Fullname < AzaharaSchema::Attribute
|
3
|
+
|
4
|
+
def arel_field
|
5
|
+
Arel::Nodes::NamedFunction.new 'CONCAT', [EgovUtils::Person.arel_table[:lastname], Arel::Nodes::SqlLiteral.new('\' \'') , EgovUtils::Person.arel_table[:firstname]]
|
6
|
+
end
|
7
|
+
|
8
|
+
def build_json_options!(options)
|
9
|
+
options[:methods] ||= []
|
10
|
+
options[:methods] << 'fullname'
|
11
|
+
options
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -66,7 +66,7 @@ module EgovUtils
|
|
66
66
|
def onthefly_creation_failed(user, provider_info={})
|
67
67
|
logger.warn "Failed onthefly_creation for '#{user.login}' (provider '#{user.provider}') from #{request.remote_ip} at #{Time.now.utc}"
|
68
68
|
flash[:error] = t(:notice_onthefly_failure)
|
69
|
-
redirect_to
|
69
|
+
redirect_to signin_path
|
70
70
|
end
|
71
71
|
|
72
72
|
def account_pending(user, redirect_path=signin_path)
|
data/app/models/ability.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
begin
|
2
2
|
require_dependency "#{Rails.application.class.parent_name.underscore}/roles"
|
3
3
|
rescue LoadError => e
|
4
|
-
Rails.logger.
|
5
|
-
Rails.logger.
|
6
|
-
Rails.logger.
|
4
|
+
Rails.logger.warn "!! You have not defined roles."
|
5
|
+
Rails.logger.warn "!! Please define it in lib/#{Rails.application.class.parent_name.underscore}/roles."
|
6
|
+
Rails.logger.warn "!! EgovUtils roles management will not work without it."
|
7
7
|
end
|
8
8
|
|
9
9
|
class Ability
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module EgovUtils
|
2
|
+
class PersonSchema < AzaharaSchema::ModelSchema
|
3
|
+
|
4
|
+
def main_attribute_name
|
5
|
+
'fullname'
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize_available_attributes
|
9
|
+
@available_attributes ||= []
|
10
|
+
@available_attributes << Fullname.new(model, 'fullname', 'string')
|
11
|
+
super
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -2,6 +2,7 @@ $ ->
|
|
2
2
|
<%
|
3
3
|
grid ||= schema.outputs.grid
|
4
4
|
additional_params ||= {}
|
5
|
+
create_attributes ||= {}
|
5
6
|
%>
|
6
7
|
|
7
8
|
$('body').off 'egov:submitted'
|
@@ -11,7 +12,7 @@ $ ->
|
|
11
12
|
|
12
13
|
<%# would be a bit cleaner to give the filled form to the shield grid create method, then send the form by ajax %>
|
13
14
|
createRecord = (evt)->
|
14
|
-
$.ajax('<%= new_polymorphic_path(schema.model, format: :js) %>')
|
15
|
+
$.ajax('<%= new_polymorphic_path(schema.model, create_attributes.merge(format: :js)) %>')
|
15
16
|
|
16
17
|
|
17
18
|
editRecord = (index)->
|
data/config/locales/cs.yml
CHANGED
@@ -169,6 +169,14 @@ module EgovUtils
|
|
169
169
|
results
|
170
170
|
end
|
171
171
|
|
172
|
+
def onthefly_register?
|
173
|
+
!!options['onthefly_register']
|
174
|
+
end
|
175
|
+
|
176
|
+
def register_members_only?
|
177
|
+
options['onthefly_register'] == 'members'
|
178
|
+
end
|
179
|
+
|
172
180
|
private
|
173
181
|
def with_timeout(&block)
|
174
182
|
timeout = 20
|
@@ -192,14 +200,6 @@ module EgovUtils
|
|
192
200
|
Net::LDAP.new options
|
193
201
|
end
|
194
202
|
|
195
|
-
def onthefly_register?
|
196
|
-
!!options['onthefly_register']
|
197
|
-
end
|
198
|
-
|
199
|
-
def register_members_only?
|
200
|
-
options['onthefly_register'] == 'members'
|
201
|
-
end
|
202
|
-
|
203
203
|
def get_user_attributes_from_ldap_entry(entry)
|
204
204
|
{
|
205
205
|
:dn => entry.dn,
|
data/lib/egov_utils/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: egov_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ondřej Ezr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -178,20 +178,6 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: ladle
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
181
|
description: We hope it will help create better systems for all the eGoverment. In
|
196
182
|
Czech Republic and maybe further.
|
197
183
|
email:
|
@@ -216,6 +202,7 @@ files:
|
|
216
202
|
- app/assets/stylesheets/egov_utils/users.css
|
217
203
|
- app/attributes/egov_utils/district.rb
|
218
204
|
- app/attributes/egov_utils/full_address.rb
|
205
|
+
- app/attributes/egov_utils/fullname.rb
|
219
206
|
- app/attributes/egov_utils/region.rb
|
220
207
|
- app/controllers/egov_utils/addresses_controller.rb
|
221
208
|
- app/controllers/egov_utils/application_controller.rb
|
@@ -240,6 +227,7 @@ files:
|
|
240
227
|
- app/models/egov_utils/principal.rb
|
241
228
|
- app/models/egov_utils/user.rb
|
242
229
|
- app/schemas/egov_utils/address_schema.rb
|
230
|
+
- app/schemas/egov_utils/person_schema.rb
|
243
231
|
- app/validators/email_validator.rb
|
244
232
|
- app/validators/ico_validator.rb
|
245
233
|
- app/views/common/_grid.html.coffee
|