appril-cli 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 85a66e9654989e986c381b45f174a7da1fd42c1d
4
- data.tar.gz: 67ec790ebc2913a72b081f1dc38f6dfea0401267
3
+ metadata.gz: 5ee721ade293046ea9df28ce0288bc064723db70
4
+ data.tar.gz: 9d20afa062e49e4187bca223248aa8104f35b8eb
5
5
  SHA512:
6
- metadata.gz: db84371f8aa1045fe52f2d444f2d8e7ad45e18a7d1983af4e18fb851982367edc323231f5131a2b7072999af09ad5a9b3306c4258c7fa4d911d1cc6d07b26dc0
7
- data.tar.gz: 3e02bda49fd24d922e6b66186ef48ffa09d98f18aaa0ba9a8cab541f5f6ef85e75742bba0ab4efe6086565ebde5d7575523f0791db59f14329face95f5c82661
6
+ metadata.gz: 06c31c0035a214fde72972d5e174fb5ef09a76d2435d1d9e7e7c412435b6c18b6decfd53af4e6e2a5b7ee04342bd424ea64274ca0bb2d83bc173c4171e83d0f7
7
+ data.tar.gz: 1e6c81f03984d229fe8fb6e56bd0cec1a0de66026ad82bf528dc1c585e6936a7c9654d47174aa8fdb28ac19347c174855412ba53055560fc1e0e446705c98121
@@ -18,6 +18,10 @@ class BaseController < Appril::BaseController
18
18
  render
19
19
  end
20
20
 
21
+ error 401 do
22
+ 'Access Dennied'
23
+ end
24
+
21
25
  error 500 do |e|
22
26
  puts "\e[0;31m%s\e[0m" % e.inspect
23
27
  e.backtrace && e.backtrace.each {|l| puts " \e[0;36m%s\e[0m" % l}
@@ -1,7 +1,24 @@
1
1
  module UserHelpers
2
2
 
3
- def user?
4
- return unless authorization_token = params[:__authorization_token__] || cookies[:__authorization_token__]
5
- # fetch user using authorization_token
3
+ def authorized_user
4
+ return unless authorization_token
5
+ # fetch user, e.g. User.find_by(authorization_token: authorization_token)
6
+ end
7
+
8
+ def authorized_user!
9
+ authorized_user || error(401)
10
+ end
11
+
12
+ def authorized_user_id
13
+ return unless authorization_token
14
+ # fetch user, e.g. User.where(authorization_token: authorization_token).pluck(:id)[0]
15
+ end
16
+
17
+ def authorized_user_id!
18
+ authorized_user_id || error(401)
19
+ end
20
+
21
+ def authorization_token
22
+ params[:__authorization_token__] || cookies[:__authorization_token__]
6
23
  end
7
24
  end
@@ -9,8 +9,6 @@ export default function(component, constructor) {
9
9
  if (layout.default)
10
10
  layout = layout.default
11
11
 
12
- delete constructor.layout
13
-
14
12
  /** comment or delete this line to pipe component through Crudle builder
15
13
  const Crudle = require('crudle').default
16
14
  Crudle.Menu = {
@@ -1,4 +0,0 @@
1
-
2
- export function __SET_ENV__({__ENV__}, {component, env}) {
3
- __ENV__[component] = env
4
- }
@@ -1,3 +1,2 @@
1
1
  export default {
2
- __ENV__: {}
3
2
  }
@@ -1,5 +1,5 @@
1
1
  module Appril
2
2
  class CLI
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '0.4.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appril-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Slee Woo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-05 00:00:00.000000000 Z
11
+ date: 2016-09-09 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Appril CLI
14
14
  email:
@@ -129,5 +129,5 @@ rubyforge_project:
129
129
  rubygems_version: 2.5.1
130
130
  signing_key:
131
131
  specification_version: 4
132
- summary: '["appril-cli-0.4.0", "Appril CLI"]'
132
+ summary: '["appril-cli-0.4.1", "Appril CLI"]'
133
133
  test_files: []