Files
Splunk_Docker/files/splunkbeta/etc/system/bin/apptemplates.py
Brett Woodruff 28c8d411ad Inital Commit
2024-06-13 15:48:26 -04:00

28 lines
910 B
Python
Executable File

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)