29 lines
703 B
Go
29 lines
703 B
Go
package enum
|
|
|
|
// RoleSource identifies the origin of a UserRole assignment. Sync-from-X
|
|
// flows (zitadel/ldap/scim) only replace assignments of their own source;
|
|
// manual stays sticky.
|
|
type RoleSource string
|
|
|
|
const (
|
|
RoleSourceManual RoleSource = "manual"
|
|
RoleSourceZitadel RoleSource = "zitadel"
|
|
RoleSourceLDAP RoleSource = "ldap"
|
|
RoleSourceSCIM RoleSource = "scim"
|
|
)
|
|
|
|
// IsValid reports whether s is a known role source.
|
|
func (s RoleSource) IsValid() bool {
|
|
switch s {
|
|
case RoleSourceManual, RoleSourceZitadel, RoleSourceLDAP, RoleSourceSCIM:
|
|
return true
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
// String returns the raw source value.
|
|
func (s RoleSource) String() string {
|
|
return string(s)
|
|
}
|