Documentation ¶
Index ¶
- Constants
- Variables
- func AddUseCluster(eac *cluster.ExternalAbstractCluster, user cn.CapUser, us UserSend) (err *mft.Error)
- func DisableUseCluster(eac *cluster.ExternalAbstractCluster, user cn.CapUser, name string) (err *mft.Error)
- func DropUseCluster(eac *cluster.ExternalAbstractCluster, user cn.CapUser, name string) (err *mft.Error)
- func EnableUseCluster(eac *cluster.ExternalAbstractCluster, user cn.CapUser, name string) (err *mft.Error)
- func GenerateError(key int, a ...interface{}) *mft.Error
- func GenerateErrorE(key int, err error, a ...interface{}) *mft.Error
- func GenerateErrorForClusterUser(user cn.CapUser, key int, a ...interface{}) *mft.Error
- func GenerateErrorForClusterUserE(user cn.CapUser, key int, err error, a ...interface{}) *mft.Error
- func PasswordMarshal(pwd string) []byte
- func Sha512(name string, pwd string) string
- func StorageOnChangeFuncGenerator(s storage.Storage, file string) func(sec *SecurityATCB) (err *mft.Error)
- func UpdateUseCluster(eac *cluster.ExternalAbstractCluster, user cn.CapUser, us UserSend) (err *mft.Error)
- type SecurityATCB
- func (s *SecurityATCB) Add(ctx context.Context, user cn.CapUser, us UserSend) (err *mft.Error)
- func (s *SecurityATCB) AdditionalCallFuncInClusterFunc(ctx context.Context, cl cluster.Cluster, request *cluster.RequestBody) (responce *cluster.ResponceBody, ok bool)
- func (s *SecurityATCB) CheckAuthFunc(ctx context.Context, serviceRequest *cluster.ServiceRequest) (ok bool, failResponce cluster.ResponceBody)
- func (s *SecurityATCB) CheckPermissionForInternal(ctx context.Context, user cn.CapUser, objectType string, action string, ...) (allowed bool, err *mft.Error)
- func (s *SecurityATCB) Disable(ctx context.Context, user cn.CapUser, name string) (err *mft.Error)
- func (s *SecurityATCB) Drop(ctx context.Context, user cn.CapUser, name string) (err *mft.Error)
- func (s *SecurityATCB) Enable(ctx context.Context, user cn.CapUser, name string) (err *mft.Error)
- func (s *SecurityATCB) Get(ctx context.Context, user cn.CapUser) (users []UserCut, err *mft.Error)
- func (s *SecurityATCB) OnChange() (err *mft.Error)
- func (s *SecurityATCB) Update(ctx context.Context, user cn.CapUser, us UserSend) (err *mft.Error)
- type User
- type UserCut
- type UserSend
Constants ¶
View Source
const (
AuthType = "basic"
)
Variables ¶
View Source
var Errors map[int]string = map[int]string{
10300000: "Security.OnChange: fail",
10300100: "Security.Add: User `%v` is already exists",
10300101: "Security.Add: Permission denied",
10300102: "Security.Add: Permission check fail",
10300200: "Security.Update: User `%v` does not exists",
10300201: "Security.Update: Permission denied",
10300202: "Security.Update: Permission check fail",
10300300: "Security.Enable: User `%v` does not exists",
10300301: "Security.Enable: Permission denied",
10300302: "Security.Enable: Permission check fail",
10300400: "Security.Disable: User `%v` does not exists",
10300401: "Security.Disable: Permission denied",
10300402: "Security.Disable: Permission check fail",
10300500: "Security.Drop: User `%v` does not exists",
10300501: "Security.Drop: Permission denied",
10300502: "Security.Drop: Permission check fail",
10300600: "StorageOnChangeFuncGenerator: fail generate json",
10300601: "StorageOnChangeFuncGenerator: fail save data",
10300700: "SecurityATRZ.StorageLoad: fail load data",
10300701: "SecurityATRZ.StorageLoad: fail unmarshal data",
10300800: "Security.Get: Permission denied",
10300801: "Security.Get: Permission check fail",
10300900: "Security.CheckAuthFunc: Unkown user `%v`",
10300901: "Security.CheckAuthFunc: User is disabled `%v`",
10300902: "Security.CheckAuthFunc: Auth user fail Unmarshal",
10300903: "Security.CheckAuthFunc: Pwd check fail for user `%v`",
10300904: "Security.CheckAuthFunc: Permission Impresonate fail",
10300905: "Security.CheckAuthFunc: Permission Impresonate denied: request: `%v`, Service: `%v`",
10300906: "Security.CheckAuthFunc: Request is NIL",
10300907: "Security.CheckAuthFunc: Incorrect AuthType",
10301000: "PasswordMarshal: Fail marshal PWD",
}
Errors codes and description
View Source
var WaitTimeout = time.Second * 5
Functions ¶
func AddUseCluster ¶
func DisableUseCluster ¶
func DropUseCluster ¶
func EnableUseCluster ¶
func GenerateErrorE ¶
GenerateErrorE -
func GenerateErrorForClusterUser ¶
GenerateError -
func GenerateErrorForClusterUserE ¶
GenerateError -
func PasswordMarshal ¶
func UpdateUseCluster ¶
Types ¶
type SecurityATCB ¶
type SecurityATCB struct { Users map[string]*User `json:"users"` // OnChange event func (send self) OnChangeFunc func(s *SecurityATCB) (err *mft.Error) `json:"-"` // case nil then ignore CheckPermissionFunc func(ctx context.Context, user cn.CapUser, objectType string, action string, objectName string) (allowed bool, err *mft.Error) `json:"-"` // contains filtered or unexported fields }
SecurityATCB - authentication basic
func StorageLoad ¶
func (*SecurityATCB) AdditionalCallFuncInClusterFunc ¶
func (s *SecurityATCB) AdditionalCallFuncInClusterFunc(ctx context.Context, cl cluster.Cluster, request *cluster.RequestBody) (responce *cluster.ResponceBody, ok bool)
func (*SecurityATCB) CheckAuthFunc ¶
func (s *SecurityATCB) CheckAuthFunc(ctx context.Context, serviceRequest *cluster.ServiceRequest, ) (ok bool, failResponce cluster.ResponceBody)
func (*SecurityATCB) CheckPermissionForInternal ¶
func (*SecurityATCB) OnChange ¶
func (s *SecurityATCB) OnChange() (err *mft.Error)
type User ¶
type UserCut ¶
func GetUseCluster ¶
Click to show internal directories.
Click to hide internal directories.