You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
910 B
28 lines
910 B
import splunk.admin as admin
|
|
import splunk.appbuilder as appbuilder
|
|
import splunk.bundle as bundle
|
|
import splunk.util
|
|
|
|
ADMIN_ALL_OBJECTS = "admin_all_objects"
|
|
EDIT_OR_INSTALL_APPS = "edit_local_apps or install_apps"
|
|
|
|
class AppTemplatesHandler(admin.MConfigHandler):
|
|
def setup(self):
|
|
limits_conf = bundle.getConf('limits', sessionKey=self.getSessionKey())
|
|
enableInstallApps = limits_conf['auth'].get("enable_install_apps", False)
|
|
if (splunk.util.normalizeBoolean(enableInstallApps)):
|
|
self.setReadCapability(EDIT_OR_INSTALL_APPS)
|
|
return
|
|
|
|
# default
|
|
self.setReadCapability(ADMIN_ALL_OBJECTS)
|
|
|
|
'''
|
|
Lists locally installed applications
|
|
'''
|
|
def handleList(self, confInfo):
|
|
for template in appbuilder.getTemplates():
|
|
confInfo[template].append('lol', 'wut')
|
|
|
|
admin.init(AppTemplatesHandler, admin.CONTEXT_APP_ONLY)
|