diff --git a/model/rbac/role.go b/model/rbac/role.go new file mode 100644 index 00000000..09f407a4 --- /dev/null +++ b/model/rbac/role.go @@ -0,0 +1,22 @@ +package rbac + +import "infini.sh/framework/core/orm" + +type Role struct { + orm.ORMObjectBase + Name string `json:"name" elastic_mapping:"name:{type:keyword}"` + Description string `json:"description" elastic_mapping:"description:{type:text}"` + RoleType string `json:"type" elastic_mapping:"type:{type:keyword}"` + Permission interface{} `json:"permission" elastic_mapping:"permission:{type:object}"` + BuiltIn bool `json:"builtin" elastic_mapping:"builtin:{type:boolean}"` //是否内置 +} +type ConsolePermission struct { + ID string `json:"id" elastic_mapping:"id:{type:keyword}"` + Name string `json:"name" elastic_mapping:"name:{type:keyword}"` +} +type ElasticsearchPermission struct { + Cluster []string `json:"cluster" elastic_mapping:"cluster:{type:object}"` + Index []string `json:"index" elastic_mapping:"index:{type:object}"` + ClusterPrivilege []string `json:"cluster_privilege" elastic_mapping:"cluster_privilege:{type:object}"` + IndexPrivilege []string `json:"index_privilege" elastic_mapping:"index_privilege:{type:object}"` +} diff --git a/model/rbac/user.go b/model/rbac/user.go new file mode 100644 index 00000000..e6de96fe --- /dev/null +++ b/model/rbac/user.go @@ -0,0 +1,12 @@ +package rbac + +import "infini.sh/framework/core/orm" + +type User struct { + orm.ORMObjectBase + Username string `json:"username" elastic_mapping:"username:{type:keyword}"` + Password string `json:"password" elastic_mapping:"password:{type:text}"` + Name string `json:"name" elastic_mapping:"name:{type:keyword}"` + Phone string `json:"phone" elastic_mapping:"phone:{type:keyword}"` + Email string `json:"email" elastic_mapping:"email:{type:keyword}"` +}