Files
plane/monitor/lib/router/handlers/instance_handler.go
Prateek Shourya 5c6d3fcd93 dev: feature flag OIDC SAML (#1079)
* chore: ff oidc saml init

* chore: admin feature flag endpoint

* [WEB-2413] chore: feature flag for admin app and OIDC SAML Auth validation.

---------

Co-authored-by: pablohashescobar <nikhilschacko@gmail.com>
2024-09-09 17:55:27 +05:30

33 lines
851 B
Go

package handlers
import (
"github.com/gofiber/fiber/v2"
prime_api "github.com/makeplane/plane-ee/monitor/lib/api"
"github.com/makeplane/plane-ee/monitor/pkg/db"
)
func GetInstanceLicenses(api prime_api.IPrimeMonitorApi, key string) func(*fiber.Ctx) error {
return func(ctx *fiber.Ctx) error {
// Initialize the variables
var exists bool
// Check if the product type is PRO or ONE on any of the licenses
record := db.Db.Model(&db.License{}).
Where("product_type IN ?", []string{"PRO", "ONE"}).Select("1").Limit(1).Find(&exists)
// If there is an error, return false
if record.Error != nil {
ctx.Status(fiber.StatusOK).JSON(fiber.Map{
"values": false,
})
return nil
}
// If the product type is not PRO or ONE, return false
ctx.Status(fiber.StatusOK).JSON(fiber.Map{
"values": exists,
})
return nil
}
}