Cross Reference: access_token.rb
xref
: /
ontohub
/
app
/
models
/
access_token.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
access_token.rb revision 68ff70f830e958de6693000b9652c9aa8cff97e7
class
AccessToken
<
ActiveRecord
::
Base
LENGTH
=
20
belongs_to
:
repository
attr_accessible
:
expiration
, :
token
def
to_s
token
end
def
expired
?
Time.now
>
expiration
end
def
self.build
_for
(
repository
)
AccessToken.new
({
repository
:
repository
,
expiration
:
fresh_expiration_date
,
token
:
SecureRandom.hex
(
LENGTH
)
}, {
without_protection
:
true
})
end
protected
def
self.fresh
_expiration_date
Settings.access_token.expiration_minutes.minutes.from
_now
end
end