snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
193
server/system/user.cue
Normal file
193
server/system/user.cue
Normal file
@@ -0,0 +1,193 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"github.com/cortezaproject/corteza/server/codegen/schema"
|
||||
)
|
||||
|
||||
user: {
|
||||
model: {
|
||||
attributes: {
|
||||
id: schema.IdField
|
||||
email: {
|
||||
sortable: true,
|
||||
unique: true,
|
||||
ignoreCase: true
|
||||
dal: { length: 254 }
|
||||
}
|
||||
email_confirmed: {
|
||||
goType: "bool"
|
||||
dal: { type: "Boolean" }
|
||||
}
|
||||
user_group_id: {
|
||||
ident: "userGroupID",
|
||||
goType: "uint64",
|
||||
storeIdent: "rel_user_group"
|
||||
dal: {
|
||||
type: "Ref",
|
||||
refModelResType: "corteza::system:user-group",
|
||||
nullable: true,
|
||||
default: 0,
|
||||
}
|
||||
|
||||
envoy: {
|
||||
yaml: {
|
||||
identKeyAlias: ["usergroup", "user_group", "user_group_id", "group"]
|
||||
}
|
||||
}
|
||||
}
|
||||
username: {
|
||||
sortable: true,
|
||||
unique: true,
|
||||
ignoreCase: true
|
||||
dal: {}
|
||||
}
|
||||
roles: {
|
||||
goType: "[]uint64",
|
||||
store: false
|
||||
omitSetter: true
|
||||
omitGetter: true
|
||||
envoy: {
|
||||
yaml: {
|
||||
customDecoder: true
|
||||
omitEncoder: true
|
||||
}
|
||||
}
|
||||
}
|
||||
name: {
|
||||
sortable: true
|
||||
dal: {}
|
||||
}
|
||||
handle: schema.HandleField
|
||||
kind: {
|
||||
sortable: true,
|
||||
goType: "types.UserKind"
|
||||
dal: { length: 8 }
|
||||
omitSetter: true
|
||||
omitGetter: true
|
||||
}
|
||||
meta: {
|
||||
goType: "*types.UserMeta"
|
||||
dal: { type: "JSON", defaultEmptyObject: true }
|
||||
omitSetter: true
|
||||
omitGetter: true
|
||||
}
|
||||
suspended_at: schema.SortableTimestampNilField
|
||||
created_at: schema.SortableTimestampNowField
|
||||
updated_at: schema.SortableTimestampNilField
|
||||
deleted_at: schema.SortableTimestampNilField
|
||||
}
|
||||
|
||||
indexes: {
|
||||
"primary": { attribute: "id" }
|
||||
"unique_email": {
|
||||
fields: [{ attribute: "email", modifiers: ["LOWERCASE"] }]
|
||||
predicate: "email != '' AND deleted_at IS NULL"
|
||||
}
|
||||
"unique_handle": {
|
||||
fields: [{ attribute: "handle", modifiers: ["LOWERCASE"] }]
|
||||
predicate: "handle != '' AND deleted_at IS NULL"
|
||||
}
|
||||
"unique_username": {
|
||||
fields: [{ attribute: "username", modifiers: ["LOWERCASE"] }]
|
||||
predicate: "username != '' AND deleted_at IS NULL"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filter: {
|
||||
struct: {
|
||||
user_id: {goType: "[]uint64", ident: "userID", storeIdent: "id"}
|
||||
role_id: {goType: "[]uint64", ident: "roleID"}
|
||||
user_group_id: {goType: "uint64", ident: "userGroupID"}
|
||||
email: {goType: "string"}
|
||||
name: {goType: "string"}
|
||||
username: {goType: "string"}
|
||||
handle: {goType: "string"}
|
||||
kind: {goType: "types.UserKind"}
|
||||
allKinds: {goType: "bool"}
|
||||
|
||||
deleted: {goType: "filter.State", storeIdent: "deleted_at"}
|
||||
suspended: {goType: "filter.State", storeIdent: "suspended_at"}
|
||||
}
|
||||
|
||||
query: ["email", "username", "handle", "name"]
|
||||
byValue: ["user_id", "email", "username", "handle"]
|
||||
byNilState: ["deleted", "suspended"]
|
||||
}
|
||||
|
||||
envoy: {
|
||||
yaml: {
|
||||
supportMappedInput: true
|
||||
mappedField: "Handle"
|
||||
identKeyAlias: ["users", "usr"]
|
||||
}
|
||||
store: {}
|
||||
}
|
||||
|
||||
rbac: {
|
||||
operations: {
|
||||
"read": description: "Read user"
|
||||
"update": description: "Update user"
|
||||
"delete": description: "Delete user"
|
||||
"suspend": description: "Suspend user"
|
||||
"unsuspend": description: "Unsuspend user"
|
||||
"email.unmask": description: "Unmask email"
|
||||
"name.unmask": description: "Unmask name"
|
||||
"impersonate": description: "Impersonate user"
|
||||
"credentials.manage": description: "Manage user's credentials"
|
||||
}
|
||||
}
|
||||
|
||||
store: {
|
||||
api: {
|
||||
lookups: [
|
||||
{
|
||||
fields: ["id"]
|
||||
description: """
|
||||
searches for user by ID
|
||||
|
||||
It returns user even if deleted or suspended
|
||||
"""
|
||||
}, {
|
||||
fields: ["email"]
|
||||
nullConstraint: ["deleted_at"]
|
||||
constraintCheck: true
|
||||
description: """
|
||||
searches for user by email
|
||||
|
||||
It returns only valid user (not deleted, not suspended)
|
||||
"""
|
||||
}, {
|
||||
fields: ["handle"]
|
||||
nullConstraint: ["deleted_at"]
|
||||
constraintCheck: true
|
||||
description: """
|
||||
searches for user by handle
|
||||
|
||||
It returns only valid user (not deleted, not suspended)
|
||||
"""
|
||||
}, {
|
||||
fields: ["username"]
|
||||
nullConstraint: ["deleted_at"]
|
||||
constraintCheck: true
|
||||
description: """
|
||||
searches for user by username
|
||||
|
||||
It returns only valid user (not deleted, not suspended)
|
||||
"""
|
||||
},
|
||||
]
|
||||
|
||||
functions: [
|
||||
{
|
||||
expIdent: "CountUsers"
|
||||
args: [ {ident: "u", goType: "types.UserFilter"}]
|
||||
return: [ "uint"]
|
||||
}, {
|
||||
expIdent: "UserMetrics"
|
||||
return: [ "*types.UserMetrics"]
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user