1. Remove ks-iam standalone binary, move it to ks-apiserver 2. Generate all devops apis inside kubesphere repository, no need to import s2ioperator. 3. Reorganize ldap code, make it more flexible to use.
41 lines
802 B
Go
41 lines
802 B
Go
package iam
|
|
|
|
import (
|
|
"kubesphere.io/kubesphere/pkg/server/errors"
|
|
"time"
|
|
)
|
|
|
|
type User struct {
|
|
Username string `json:"username"`
|
|
Email string `json:"email"`
|
|
Lang string `json:"lang,omitempty"`
|
|
Description string `json:"description"`
|
|
CreateTime time.Time `json:"create_time"`
|
|
Groups []string `json:"groups,omitempty"`
|
|
Password string `json:"password,omitempty"`
|
|
}
|
|
|
|
func NewUser() *User {
|
|
return &User{
|
|
Username: "",
|
|
Email: "",
|
|
Lang: "",
|
|
Description: "",
|
|
CreateTime: time.Time{},
|
|
Groups: nil,
|
|
Password: "",
|
|
}
|
|
}
|
|
|
|
func (u *User) Validate() error {
|
|
if u.Username == "" {
|
|
return errors.New("username can not be empty")
|
|
}
|
|
|
|
if u.Password == "" {
|
|
return errors.New("password can not be empty")
|
|
}
|
|
|
|
return nil
|
|
}
|