Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F906942
api_controller.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Aug 30, 11:54 AM
Size
517 B
Mime Type
text/x-ruby
Expires
Mon, Sep 1, 11:54 AM (1 d, 6 h)
Engine
blob
Format
Raw Data
Handle
253723
Attached To
rWEBDNS WebDNS (edet4)
api_controller.rb
View Options
class
ApiController
<
ApplicationController
# This a private trusted API
skip_before_action
:verify_authenticity_token
before_action
:authenticate_token
# GET /ping
def
ping
render
json
:
{
ok
:
true
,
response
:
:pong
}
end
# GET /whoami
def
whoami
render
json
:
{
ok
:
true
,
response
:
current_user
.
to_api
}
end
private
def
authenticate_token
if
user
=
User
.
find_by_token
(
params
.
require
(
:token
))
warden
.
set_user
(
user
,
store
:
false
)
else
head
(
403
)
end
end
end
Event Timeline
Log In to Comment