def _get_service_for_current_app(request):
    if not hasattr(request, '_cached_service_for_current_app'):
        request._cached_service_for_current_app = create_derived_service(
            _get_service(request),
            owner='nobody',
            app=get_current_app_name(request))
    return request._cached_service_for_current_app
Exemple #2
0
def home(request):
    apps = []
    for app in settings.USER_APPS:
        if app == "homefx":
            continue

        # Workaround Configurations.__getitem__ not supporting namespace
        # override correctly for individual lookups. (DVPL-2155)
        app_service = create_derived_service(request.service,
                                             owner='nobody',
                                             app=app)
        try:
            app_conf = app_service.confs['app']
        except KeyError:
            # App does not have an app.conf
            app_conf = None

        info = {
            'author': _get_conf_key(app_conf, 'launcher', 'author') or "",
            'description': _get_conf_key(app_conf, 'launcher', 'description')
            or _NO_DESCRIPTION,
            'name': app,
            'label': _get_conf_key(app_conf, 'ui', 'label') or app,
            'version': _get_conf_key(app_conf, 'launcher', 'version') or "0.0"
        }
        apps.append(info)

    return {'apps': apps}
def _get_service_for_current_app(request):
    if not hasattr(request, '_cached_service_for_current_app'):
        request._cached_service_for_current_app = create_derived_service(
            _get_service(request),
            owner='nobody',
            app=get_current_app_name(request))
    return request._cached_service_for_current_app
def home(request):
    apps = []
    for app in settings.USER_APPS:
        if app == "homefx":
            continue
        
        # Workaround Configurations.__getitem__ not supporting namespace
        # override correctly for individual lookups. (DVPL-2155)
        app_service = create_derived_service(request.service, owner='nobody', app=app)
        try:
            app_conf = app_service.confs['app']
        except KeyError:
            # App does not have an app.conf
            app_conf = None
        
        info = {
            'author': _get_conf_key(app_conf, 'launcher', 'author') or "",
            'description': _get_conf_key(app_conf, 'launcher', 'description') or _NO_DESCRIPTION,
            'name': app,
            'label': _get_conf_key(app_conf, 'ui', 'label') or app,
            'version': _get_conf_key(app_conf, 'launcher', 'version') or "0.0"
        }
        apps.append(info)

    return { 'apps': apps }
Exemple #5
0
def palettelist(request):
    derived_service = create_derived_service(
        request.user.service,
        owner=request.user.service.username,
        app='splunk_app_windows_infrastructure')

    return ConfigurationFile(derived_service,
                             'configs/conf-palettepalettes',
                             state={'title': 'palettepalettes'})
 def _verify_app_is_enabled(self, service, app_name):
     if app_name and app_name == 'homefx':
         return
     
     # We need to use the most general service as the app may be disabled.
     service = create_derived_service(service, app=None, owner=None)
     try:
         app = service.apps[app_name]
         if app['disabled'] == '1' or app['visible'] == '0':
             raise Http404("Application '%s' is disabled." % app_name)
     except:
         raise Http404("Application '%s' is disabled." % app_name)