Cross Reference: ssh_access_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
ssh_access_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
ssh_access_controller.rb revision 85515362f18a088f955a6b12fe37e109b5a2d3fc
class
SshAccessController
<
InheritedResources
::
Base
belongs_to
:
repository
,
finder
: :
find_by_path
!
def
index
allowed
=
false
key_id
=
params
[:
key_id
]
key_field
=
key_id.sub
(
"key-"
,
""
)
requested_permission
=
params
[:
permission
]
user
=
User.joins
(:
keys
)
.
where
(
keys
: {
id
:
key_field
})
.
first
repository
=
parent
permission
=
user.permissions
.
where
(
item_id
:
repository.id
,
item_type
:
repository.class
)
.
first
allowed
=
SshAccess.determine
_permission
(
requested_permission
,
permission
)
render
json
: {
allowed
:
allowed
}
end
end