We can get push access info from current user record
This commit is contained in:
parent
8e5d40029a
commit
e382d3015d
|
@ -44,21 +44,9 @@ Route = TravisRoute.extend
|
||||||
|
|
||||||
hasPushAccess: ->
|
hasPushAccess: ->
|
||||||
repoId = parseInt @modelFor('repo').get('id')
|
repoId = parseInt @modelFor('repo').get('id')
|
||||||
pushAccess = true
|
|
||||||
|
|
||||||
Ajax.get '/users/permissions', (data) =>
|
@auth.get('currentUser').get('pushPermissions').filter (item) ->
|
||||||
|
item == repoId
|
||||||
admin = data.admin.filter (item) ->
|
|
||||||
return item == repoId
|
|
||||||
push = data.push.filter (item) ->
|
|
||||||
return item == repoId
|
|
||||||
pull = data.pull.filter (item) ->
|
|
||||||
return item == repoId
|
|
||||||
|
|
||||||
if Ember.isEmpty admin && Ember.isEmpty push && !Ember.isEmpty pull
|
|
||||||
pushAccess = false
|
|
||||||
|
|
||||||
pushAccess
|
|
||||||
|
|
||||||
model: () ->
|
model: () ->
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user