corn_starch 1.9.34 → 1.9.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/corn_starch/corn_starch_controller.rb +18 -21
- data/lib/corn_starch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfb7bc76d9c5bd6b6245e39782c39c772b2e884e
|
4
|
+
data.tar.gz: 5c8ea870877ea544157ceb1a91462258255920d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0538eca55686973e83a5dca2251b83796763c15e7956be72ebc8d24bfdbf40577d7c58669e79452f61d7e1b06d13640c863598279e7b8dab4b9227fe3eabc08f
|
7
|
+
data.tar.gz: 78dc0ede5c6084ef436bc3b23b57f911cf18f954a7af08f4364fbab3837a4eee374d87f104beb86650b7c8455d23809b6789eda3d24306decf4e800fadf9868d
|
@@ -38,22 +38,22 @@ module CornStarch
|
|
38
38
|
|
39
39
|
# Authentication Filter
|
40
40
|
def auth_filter
|
41
|
-
redirect_to corn_starch.new_session_url,
|
41
|
+
redirect_to corn_starch.new_session_url, notify_acs_denied('auth.login_required') unless is_authed
|
42
42
|
end
|
43
43
|
|
44
44
|
# Un-Authentication Filter
|
45
45
|
def unauth_filter
|
46
|
-
redirect_to root_url,
|
46
|
+
redirect_to root_url, notify_acs_denied('auth.already_logged_in') if is_authed
|
47
47
|
end
|
48
48
|
|
49
49
|
# Self Filter
|
50
50
|
def self_filter
|
51
|
-
redirect_to root_url,
|
51
|
+
redirect_to root_url, notify_acs_denied('auth.invalid_user_id') unless is_self
|
52
52
|
end
|
53
53
|
|
54
54
|
# Not Self Filter
|
55
55
|
def not_self_filter
|
56
|
-
redirect_to root_url,
|
56
|
+
redirect_to root_url, notify_acs_denied('auth.invalid_user_id') if is_self
|
57
57
|
end
|
58
58
|
|
59
59
|
# Pagination Filter
|
@@ -249,23 +249,15 @@ module CornStarch
|
|
249
249
|
when :login then notify_res 'gen_msg.login', result_or_name, name: uname
|
250
250
|
when :logout then notify 'gen_msg.logout'
|
251
251
|
|
252
|
-
#
|
253
|
-
when :create
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
fail: { head: t('gen_msg.update.fail.head', model: model), body: t('gen_msg.update.fail.body', errors: errors) }
|
262
|
-
}[result_or_name]
|
263
|
-
when :destroy
|
264
|
-
{ head: t('gen_msg.destroy.head', model: model), body: t('gen_msg.destroy.body', model: model, name: result_or_name) }
|
265
|
-
|
266
|
-
# Error
|
267
|
-
else
|
268
|
-
{ head: t('gen_msg.unknown_action.head'), body: t('gen_msg.unknown_action.body', action: action) }
|
252
|
+
# Create / Update Resources
|
253
|
+
when :create then notify_res 'gen_msg.create', result_or_name, model: model, name: ename, errors: errors
|
254
|
+
when :update then notify_res 'gen_msg.update', result_or_name, model: model, name: ename, errors: errors
|
255
|
+
|
256
|
+
# Destroy Resources
|
257
|
+
when :destroy then notify 'gen_msg.destroy', { model: model, name: result_or_name }, { model: model }
|
258
|
+
|
259
|
+
# Unknown Action
|
260
|
+
else notify 'gen_msg.unknown_action', action: action
|
269
261
|
end
|
270
262
|
end
|
271
263
|
|
@@ -283,5 +275,10 @@ module CornStarch
|
|
283
275
|
def notify_res key, res, head_hash = nil, body_hash = nil
|
284
276
|
Hash[[:pass, :fail].map { |r| notify "#{key}.#{r}", head_hash, body_hash }][res]
|
285
277
|
end
|
278
|
+
|
279
|
+
# Build Access-Denied Notification
|
280
|
+
def notify_acs_denied key
|
281
|
+
{ alert: { head: t('auth.access_denied'), body: t(key) } }
|
282
|
+
end
|
286
283
|
end
|
287
284
|
end
|
data/lib/corn_starch/version.rb
CHANGED