grafana/pkg/models/org.go
gotjosh 0cbbb43222
LDAP: Add API endpoint to debug user mapping from LDAP (#18833)
* Move the ReloadLDAPCfg function to the debug file

Appears to be a better suite place for this.

* LDAP: Return the server information when we find a specific user

We allow you to specify multiple LDAP servers as part of LDAP authentication integration. As part of searching for specific users, we need to understand from which server they come from. Returning the server configuration as part of the search will help us do two things:

- Understand in which server we found the user
- Have access the groups specified as part of the server configuration

* LDAP: Adds the /api/admin/ldap/:username endpoint

This endpoint returns a user found within the configured LDAP server(s). Moreso, it provides the mapping information for the user to help administrators understand how the users would be created within Grafana based on the current configuration.

No changes are executed or saved to the database, this is all an in-memory representation of how the final result would look like.
2019-09-03 18:34:44 +01:00

91 lines
1.3 KiB
Go

package models
import (
"errors"
"time"
)
// Typed errors
var (
ErrOrgNotFound = errors.New("Organization not found")
ErrOrgNameTaken = errors.New("Organization name is taken")
)
type Org struct {
Id int64
Version int
Name string
Address1 string
Address2 string
City string
ZipCode string
State string
Country string
Created time.Time
Updated time.Time
}
// ---------------------
// COMMANDS
type CreateOrgCommand struct {
Name string `json:"name" binding:"Required"`
// initial admin user for account
UserId int64 `json:"-"`
Result Org `json:"-"`
}
type DeleteOrgCommand struct {
Id int64
}
type UpdateOrgCommand struct {
Name string
OrgId int64
}
type UpdateOrgAddressCommand struct {
OrgId int64
Address
}
type GetOrgByIdQuery struct {
Id int64
Result *Org
}
type GetOrgByNameQuery struct {
Name string
Result *Org
}
type SearchOrgsQuery struct {
Query string
Name string
Limit int
Page int
Ids []int64
Result []*OrgDTO
}
type OrgDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
}
type OrgDetailsDTO struct {
Id int64 `json:"id"`
Name string `json:"name"`
Address Address `json:"address"`
}
type UserOrgDTO struct {
OrgId int64 `json:"orgId"`
Name string `json:"name"`
Role RoleType `json:"role"`
}