mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 12:02:18 +08:00

* Create own legacy store function to list service accounts and update api model * Add service account tokens as a sub resource for service accounts
26 lines
555 B
Go
26 lines
555 B
Go
package common
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
iamv0 "github.com/grafana/grafana/pkg/apis/iam/v0alpha1"
|
|
"github.com/grafana/grafana/pkg/services/team"
|
|
)
|
|
|
|
// OptonalFormatInt formats num as a string. If num is less or equal than 0
|
|
// an empty string is returned.
|
|
func OptionalFormatInt(num int64) string {
|
|
if num > 0 {
|
|
return strconv.FormatInt(num, 10)
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func MapTeamPermission(p team.PermissionType) iamv0.TeamPermission {
|
|
if p == team.PermissionTypeAdmin {
|
|
return iamv0.TeamPermissionAdmin
|
|
} else {
|
|
return iamv0.TeamPermissionMember
|
|
}
|
|
}
|