Beispiel #1
0
func GetAppSettingsById(c *middleware.Context) Response {
	appId := c.Params(":appId")

	if pluginDef, exists := plugins.Apps[appId]; !exists {
		return ApiError(404, "PluginId not found, no installed plugin with that id", nil)
	} else {
		orgApps, err := plugins.GetOrgAppSettings(c.OrgId)
		if err != nil {
			return ApiError(500, "Failed to get org app settings ", nil)
		}
		orgApp := orgApps[appId]

		return Json(200, dtos.NewAppSettingsDto(pluginDef, orgApp))
	}
}
Beispiel #2
0
func GetOrgAppsList(c *middleware.Context) Response {
	orgApps, err := plugins.GetOrgAppSettings(c.OrgId)

	if err != nil {
		return ApiError(500, "Failed to list of apps", err)
	}

	result := make([]*dtos.AppSettings, 0)
	for _, app := range plugins.Apps {
		orgApp := orgApps[app.Id]
		result = append(result, dtos.NewAppSettingsDto(app, orgApp))
	}

	return Json(200, result)
}