Added permission check for integtrations plugins.

This commit is contained in:
Martin Edenhofer 2017-11-02 09:14:59 +01:00
parent 725f21337d
commit 1ef49c9e1b
6 changed files with 17 additions and 3 deletions

View file

@ -157,6 +157,7 @@ App.Config.set(
description: 'A powerfull service to get more information about your customers.'
controller: Index
state: State
permission: ['admin.integration.clearbit']
}
'NavBarIntegrations'
)

View file

@ -535,6 +535,7 @@ App.Config.set(
description: 'Exchange integration for contacts management.'
controller: Index
state: State
permission: ['admin.integration.exchange']
}
'NavBarIntegrations'
)

View file

@ -26,6 +26,7 @@ App.Config.set(
description: 'An open source monitoring tool.'
controller: Index
state: State
permission: ['admin.integration.icinga']
}
'NavBarIntegrations'
)

View file

@ -3,7 +3,7 @@ class Index extends App.ControllerIntegrationBase
featureName: 'i-doit'
featureConfig: 'idoit_config'
description: [
['This service allows you to connect i-doit objects with Zammad.']
['This service allows you to connect %s with %s.', 'i-doit', 'Zammad']
]
events:
'change .js-switch input': 'switch'

View file

@ -587,6 +587,7 @@ App.Config.set(
description: 'LDAP integration for user management.'
controller: Index
state: State
permission: ['admin.integration.ldap']
}
'NavBarIntegrations'
)

View file

@ -33,11 +33,21 @@ class Index extends App.ControllerSubContent
render: =>
return if @initRender && @integration
@user = App.User.find(App.Session.get('id'))
@initRender = true
integrations = []
for key, value of @integrationItems
value.key = key
integrations.push value
if !value.permission
value.key = key
integrations.push value
else
match = false
for permissionName in value.permission
if !match && @user.permission(permissionName)
match = true
value.key = key
integrations.push value
integrations = _.sortBy(integrations, (item) -> return item.name)
@html App.view('integration/index')(
head: 'Integrations'