mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:37:34 +00:00
feat: add schema user create and remove (#8494)
# Which Problems Are Solved Added functionality that user with a userschema can be created and removed. # How the Problems Are Solved Added logic and moved APIs so that everything is API v3 conform. # Additional Changes - move of user and userschema API to resources folder - changed testing and parameters - some renaming # Additional Context closes #7308 --------- Co-authored-by: Elio Bischof <elio@zitadel.com>
This commit is contained in:
@@ -15,19 +15,21 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
prepareUserSchemasStmt = `SELECT projections.user_schemas.id,` +
|
||||
` projections.user_schemas.change_date,` +
|
||||
` projections.user_schemas.sequence,` +
|
||||
` projections.user_schemas.instance_id,` +
|
||||
` projections.user_schemas.state,` +
|
||||
` projections.user_schemas.type,` +
|
||||
` projections.user_schemas.revision,` +
|
||||
` projections.user_schemas.schema,` +
|
||||
` projections.user_schemas.possible_authenticators,` +
|
||||
prepareUserSchemasStmt = `SELECT projections.user_schemas1.id,` +
|
||||
` projections.user_schemas1.creation_date,` +
|
||||
` projections.user_schemas1.change_date,` +
|
||||
` projections.user_schemas1.sequence,` +
|
||||
` projections.user_schemas1.instance_id,` +
|
||||
` projections.user_schemas1.state,` +
|
||||
` projections.user_schemas1.type,` +
|
||||
` projections.user_schemas1.revision,` +
|
||||
` projections.user_schemas1.schema,` +
|
||||
` projections.user_schemas1.possible_authenticators,` +
|
||||
` COUNT(*) OVER ()` +
|
||||
` FROM projections.user_schemas`
|
||||
prepareUserSchemasCols = []string{
|
||||
"id",
|
||||
"creation_date",
|
||||
"change_date",
|
||||
"sequence",
|
||||
"instance_id",
|
||||
@@ -39,18 +41,20 @@ var (
|
||||
"count",
|
||||
}
|
||||
|
||||
prepareUserSchemaStmt = `SELECT projections.user_schemas.id,` +
|
||||
` projections.user_schemas.change_date,` +
|
||||
` projections.user_schemas.sequence,` +
|
||||
` projections.user_schemas.instance_id,` +
|
||||
` projections.user_schemas.state,` +
|
||||
` projections.user_schemas.type,` +
|
||||
` projections.user_schemas.revision,` +
|
||||
` projections.user_schemas.schema,` +
|
||||
` projections.user_schemas.possible_authenticators` +
|
||||
prepareUserSchemaStmt = `SELECT projections.user_schemas1.id,` +
|
||||
` projections.user_schemas1.creation_date,` +
|
||||
` projections.user_schemas1.change_date,` +
|
||||
` projections.user_schemas1.sequence,` +
|
||||
` projections.user_schemas1.instance_id,` +
|
||||
` projections.user_schemas1.state,` +
|
||||
` projections.user_schemas1.type,` +
|
||||
` projections.user_schemas1.revision,` +
|
||||
` projections.user_schemas1.schema,` +
|
||||
` projections.user_schemas1.possible_authenticators` +
|
||||
` FROM projections.user_schemas`
|
||||
prepareUserSchemaCols = []string{
|
||||
"id",
|
||||
"creation_date",
|
||||
"change_date",
|
||||
"sequence",
|
||||
"instance_id",
|
||||
@@ -96,6 +100,7 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
{
|
||||
"id",
|
||||
testNow,
|
||||
testNow,
|
||||
uint64(20211109),
|
||||
"instance-id",
|
||||
domain.UserSchemaStateActive,
|
||||
@@ -113,9 +118,10 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
},
|
||||
UserSchemas: []*UserSchema{
|
||||
{
|
||||
ID: "id",
|
||||
ObjectDetails: domain.ObjectDetails{
|
||||
ID: "id",
|
||||
EventDate: testNow,
|
||||
CreationDate: testNow,
|
||||
Sequence: 20211109,
|
||||
ResourceOwner: "instance-id",
|
||||
},
|
||||
@@ -139,6 +145,7 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
{
|
||||
"id-1",
|
||||
testNow,
|
||||
testNow,
|
||||
uint64(20211109),
|
||||
"instance-id",
|
||||
domain.UserSchemaStateActive,
|
||||
@@ -150,6 +157,7 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
{
|
||||
"id-2",
|
||||
testNow,
|
||||
testNow,
|
||||
uint64(20211110),
|
||||
"instance-id",
|
||||
domain.UserSchemaStateInactive,
|
||||
@@ -167,9 +175,10 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
},
|
||||
UserSchemas: []*UserSchema{
|
||||
{
|
||||
ID: "id-1",
|
||||
ObjectDetails: domain.ObjectDetails{
|
||||
ID: "id-1",
|
||||
EventDate: testNow,
|
||||
CreationDate: testNow,
|
||||
Sequence: 20211109,
|
||||
ResourceOwner: "instance-id",
|
||||
},
|
||||
@@ -180,9 +189,10 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
PossibleAuthenticators: database.NumberArray[domain.AuthenticatorType]{domain.AuthenticatorTypeUsername, domain.AuthenticatorTypePassword},
|
||||
},
|
||||
{
|
||||
ID: "id-2",
|
||||
ObjectDetails: domain.ObjectDetails{
|
||||
ID: "id-2",
|
||||
EventDate: testNow,
|
||||
CreationDate: testNow,
|
||||
Sequence: 20211110,
|
||||
ResourceOwner: "instance-id",
|
||||
},
|
||||
@@ -240,6 +250,7 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
[]driver.Value{
|
||||
"id",
|
||||
testNow,
|
||||
testNow,
|
||||
uint64(20211109),
|
||||
"instance-id",
|
||||
domain.UserSchemaStateActive,
|
||||
@@ -251,9 +262,10 @@ func Test_UserSchemaPrepares(t *testing.T) {
|
||||
),
|
||||
},
|
||||
object: &UserSchema{
|
||||
ID: "id",
|
||||
ObjectDetails: domain.ObjectDetails{
|
||||
ID: "id",
|
||||
EventDate: testNow,
|
||||
CreationDate: testNow,
|
||||
Sequence: 20211109,
|
||||
ResourceOwner: "instance-id",
|
||||
},
|
||||
|
Reference in New Issue
Block a user