Commit Graph

1055 Commits

Author SHA1 Message Date
Iraq Jaber
41ea48a5f1 fixup! docs: fix broken link (#9988) 2025-05-30 19:14:47 +02:00
Iraq Jaber
24a70a425f Merge branch 'org_api_3' into org_api_merge_2 2025-05-30 19:04:30 +02:00
Iraq Jaber
5f1e7cca2f fixup! Merge branch 'main' into org_api_merge 2025-05-30 18:55:32 +02:00
Iraq Jaber
99d33505cf fixup! Merge branch 'main' into org_api_merge 2025-05-30 18:36:21 +02:00
Iraq Jaber
ee18197404 Merge branch 'org_api_2' into org_api_merge_2 2025-05-30 18:21:06 +02:00
Iraq Jaber
f4b6b3a06c fixup! Merge branch 'main' into org_api_merge 2025-05-30 15:55:21 +02:00
Iraq Jaber
f073a8ff3a fixup! fixup! feat(db): adding relational instance table 2025-05-28 11:48:24 +02:00
Iraq Jaber
af90f94f8d changes based on talk with stefan 2025-05-27 08:50:02 +02:00
Iraq Jaber
bfe3c181d4 fixup! feat(api): moving organization API resourced based 2025-05-21 16:53:30 +02:00
Iraq Jaber
fd60f5c6e9 feat(api): moving organization API resourced based 2025-05-21 16:44:03 +02:00
Iraq Jaber
5e3951c7f8 fixup! fixup! Merge branch 'main' into org_api 2025-05-21 16:36:44 +02:00
Iraq Jaber
5af4e3b7aa fixup! Merge branch 'main' into org_api 2025-05-21 14:50:00 +02:00
Stefan Benz
7eb45c6cfd feat: project v2beta resource API (#9742)
# Which Problems Are Solved

Resource management of projects and sub-resources was before limited by
the context provided by the management API, which would mean you could
only manage resources belonging to a specific organization.

# How the Problems Are Solved

With the addition of a resource-based API, it is now possible to manage
projects and sub-resources on the basis of the resources themselves,
which means that as long as you have the permission for the resource,
you can create, read, update and delete it.

- CreateProject to create a project under an organization
- UpdateProject to update an existing project
- DeleteProject to delete an existing project
- DeactivateProject and ActivateProject to change the status of a
project
- GetProject to query for a specific project with an identifier
- ListProject to query for projects and granted projects
- CreateProjectGrant to create a project grant with project and granted
organization
- UpdateProjectGrant to update the roles of a project grant
- DeactivateProjectGrant and ActivateProjectGrant to change the status
of a project grant
- DeleteProjectGrant to delete an existing project grant
- ListProjectGrants to query for project grants
- AddProjectRole to add a role to an existing project
- UpdateProjectRole to change texts of an existing role
- RemoveProjectRole to remove an existing role
- ListProjectRoles to query for project roles

# Additional Changes

- Changes to ListProjects, which now contains granted projects as well
- Changes to messages as defined in the
[API_DESIGN](https://github.com/zitadel/zitadel/blob/main/API_DESIGN.md)
- Permission checks for project functionality on query and command side
- Added testing to unit tests on command side
- Change update endpoints to no error returns if nothing changes in the
resource
- Changed all integration test utility to the new service
- ListProjects now also correctly lists `granted projects`
- Permission checks for project grant and project role functionality on
query and command side
- Change existing pre checks so that they also work resource specific
without resourceowner
- Added the resourceowner to the grant and role if no resourceowner is
provided
- Corrected import tests with project grants and roles
- Added testing to unit tests on command side
- Change update endpoints to no error returns if nothing changes in the
resource
- Changed all integration test utility to the new service
- Corrected some naming in the proto files to adhere to the API_DESIGN

# Additional Context

Closes #9177

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2025-05-21 14:40:47 +02:00
Iraq Jaber
01b263d7cb Merge branch 'main' into org_api 2025-05-21 14:36:09 +02:00
Iraq Jaber
390c694b46 fixup! fixup! Merge branch 'org_api_docs' into org_api 2025-05-21 14:28:19 +02:00
alfa-alex
6889d6a1da feat: add custom org ID to AddOrganizationRequest (#9720)
# Which Problems Are Solved

- It is not possible to specify a custom organization ID when creating
an organization. According to
https://github.com/zitadel/zitadel/discussions/9202#discussioncomment-11929464
this is "an inconsistency in the V2 API".

# How the Problems Are Solved

- Adds the `org_id` as an optional parameter to the
`AddOrganizationRequest` in the `v2beta` API.

# Additional Changes

None. 

# Additional Context

- Discussion
[#9202](https://github.com/zitadel/zitadel/discussions/9202)
- I was mostly interested in how much work it'd be to add this field.
Then after completing this, I thought I'd submit this PR. I won't be
angry if you just close this PR with the reasoning "we didn't ask for
it". 😄
- Even though I don't think this is a breaking change, I didn't add this
to the `v2` API yet (don't know what the process for this is TBH). The
changes should be analogous, so if you want me to, just request it.

---------

Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
2025-05-21 12:55:40 +02:00
Iraq Jaber
cb2c2e77bf fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-21 12:52:12 +02:00
Marco A.
490e4bd623 feat: instance requests implementation for resource API (#9830)
<!--
Please inform yourself about the contribution guidelines on submitting a
PR here:
https://github.com/zitadel/zitadel/blob/main/CONTRIBUTING.md#submit-a-pull-request-pr.
Take note of how PR/commit titles should be written and replace the
template texts in the sections below. Don't remove any of the sections.
It is important that the commit history clearly shows what is changed
and why.
Important: By submitting a contribution you agree to the terms from our
Licensing Policy as described here:
https://github.com/zitadel/zitadel/blob/main/LICENSING.md#community-contributions.
-->

# Which Problems Are Solved

These changes introduce resource-based API endpoints for managing
instances and custom domains.

There are 4 types of changes:

- Endpoint implementation: consisting of the protobuf interface and the
implementation of the endpoint. E.g:
606439a172
- (Integration) Tests: testing the implemented endpoint. E.g:
cdfe1f0372
- Fixes: Bugs found during development that are being fixed. E.g:
acbbeedd32
- Miscellaneous: code needed to put everything together or that doesn't
fit any of the above categories. E.g:
529df92abc or
6802cb5468

# How the Problems Are Solved

_Ticked checkboxes indicate that the functionality is complete_

- [x] Instance
  - [x] Create endpoint
  - [x] Create endpoint tests
  - [x] Update endpoint
  - [x] Update endpoint tests
  - [x] Get endpoint
  - [x] Get endpoint tests
  - [x] Delete endpoint
  - [x] Delete endpoint tests
- [x] Custom Domains
  - [x] Add custom domain
  - [x] Add custom domain tests
  - [x] Remove custom domain
  - [x] Remove custom domain tests
  - [x] List custom domains
  - [x] List custom domains tests
- [x] Trusted Domains
  - [x] Add trusted domain
  - [x] Add trusted domain tests
  - [x] Remove trusted domain
  - [x] Remove trusted domain tests
  - [x] List trusted domains
  - [x] List trusted domains tests

# Additional Changes

When looking for instances (through the `ListInstances` endpoint)
matching a given query, if you ask for the results to be order by a
specific column, the query will fail due to a syntax error. This is
fixed in acbbeedd32 . Further explanation
can be found in the commit message

# Additional Context

- Relates to #9452 
- CreateInstance has been excluded:
https://github.com/zitadel/zitadel/issues/9930
- Permission checks / instance retrieval (middleware) needs to be
changed to allow context based permission checks
(https://github.com/zitadel/zitadel/issues/9929), required for
ListInstances

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2025-05-21 10:50:44 +02:00
Iraq Jaber
83a5371fe6 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-21 10:34:52 +02:00
Livio Spring
a73acbcfc3 fix(login): render error properly when auto creation fails (#9871)
# Which Problems Are Solved

If an IdP has the `automatic creation` option enabled without the
`account creation allowed (manually)` and does not provide all the
information required (given name, family name, ...) the wrong error
message was presented to the user.

# How the Problems Are Solved

Prevent overwrite of the error when rendering the error in the
`renderExternalNotFoundOption` function.

# Additional Changes

none

# Additional Context

- closes #9766
- requires backport to 2.x and 3.x

Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
2025-05-20 17:18:32 +00:00
Iraq Jaber
733b0852d5 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-20 14:11:40 +02:00
Iraq Jaber
1fde70ff7c fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-20 11:37:11 +02:00
Iraq Jaber
477fb8aba6 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-20 10:35:23 +02:00
Stefan Benz
6b07e57e5c test: fix list orgs test with sort (#9909)
# Which Problems Are Solved

List organization integration test fails sometimes due to incorrect
sorting of results.

# How the Problems Are Solved

Add sorting column to request on list organizations endpoint and sort
expected results.

# Additional Changes

None

# Additional Context

None
2025-05-20 09:32:09 +02:00
Iraq Jaber
5bdc19a6c0 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-19 18:15:18 +02:00
Iraq Jaber
fe74d6b88d fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-19 17:22:50 +02:00
Livio Spring
968d91a3e0 chore: update dependencies (#9784)
# Which Problems Are Solved

Some dependencies are out of date and published new version including
(unaffected) vulnerability fixes.

# How the Problems Are Solved

- Updated at least all direct dependencies apart from i18n, webauthn
(existing issues),
  -  crewjam (https://github.com/zitadel/zitadel/issues/9783) and
- github.com/gorilla/csrf (https://github.com/gorilla/csrf/issues/190,
https://github.com/gorilla/csrf/issues/189,
https://github.com/gorilla/csrf/issues/188,
https://github.com/gorilla/csrf/issues/187,
https://github.com/gorilla/csrf/issues/186)
      -  noteworthy: https://github.com/golang/go/issues/73626
- Some dependencies require Go 1.24, which triggered an update for
zitadel to go 1.24 as well.

# Additional Changes

None

# Additional Context

None
2025-05-19 10:16:49 +00:00
Livio Spring
1b2fd23e0b fix: idp user information mapping (#9892)
# Which Problems Are Solved

When retrieving the information of an IdP intent, depending on the IdP
type (e.g. Apple), there was issue when mapping the stored (event)
information back to the specific IdP type, potentially leading to a
panic.

# How the Problems Are Solved

- Correctly initialize the user struct to map the information to.

# Additional Changes

none

# Additional Context

- reported by a support request
- needs backport to 3.x and 2.x
2025-05-19 09:25:17 +00:00
Iraq Jaber
07ffc92481 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-12 09:01:28 +02:00
Iraq Jaber
f9e9f9cdff fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-12 09:00:03 +02:00
Iraq Jaber
5f014d6057 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-08 20:39:49 +02:00
Iraq Jaber
a26ccd5393 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-08 20:33:34 +02:00
Elio Bischof
898366c537 fix: allow user self deletion (#9828)
# Which Problems Are Solved

Currently, users can't delete themselves using the V2 RemoveUser API
because of the redunant API middleware permission check.

On main, using a machine user PAT to delete the same machine user:

```bash
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" -d '{"userId": "318838604669387137"}' localhost:8080 zitadel.user.v2.UserService.DeleteUser
ERROR:
  Code: NotFound
  Message: membership not found (AUTHZ-cdgFk)
  Details:
  1)	{
    	  "@type": "type.googleapis.com/zitadel.v1.ErrorDetail",
    	  "id": "AUTHZ-cdgFk",
    	  "message": "membership not found"
    	}
```

Same on this PRs branch:

```bash
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" -d '{"userId": "318838604669387137"}' localhost:8080 zitadel.user.v2.UserService.DeleteUser
{
  "details": {
    "sequence": "3",
    "changeDate": "2025-05-06T13:44:54.349048Z",
    "resourceOwner": "318838541083804033"
  }
}
```

Repeated call
```bash
grpcurl -plaintext -H "Authorization: Bearer ${ZITADEL_ACCESS_TOKEN}" -d '{"userId": "318838604669387137"}' localhost:8080 zitadel.user.v2.UserService.DeleteUser
ERROR:
  Code: Unauthenticated
  Message: Errors.Token.Invalid (AUTH-7fs1e)
  Details:
  1)	{
    	  "@type": "type.googleapis.com/zitadel.v1.ErrorDetail",
    	  "id": "AUTH-7fs1e",
    	  "message": "Errors.Token.Invalid"
    	}
```

# How the Problems Are Solved

The middleware permission check is disabled and the
domain.PermissionCheck is used exclusively.

# Additional Changes

A new type command.PermissionCheck allows to optionally accept a
permission check for commands, so APIs with middleware permission checks
can omit redundant permission checks by passing nil while APIs without
middleware permission checks can pass one to the command.

# Additional Context

This is a subtask of #9763

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
2025-05-07 15:24:24 +02:00
Iraq Jaber
34892286bf fixup! fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-07 14:04:51 +02:00
Iraq Jaber
06bc789b99 fixup! fixup! fixup! Merge branch 'main' into org_api 2025-05-07 13:57:08 +02:00
Iraq Jaber
73eb43bb87 fixup! fixup! Merge branch 'main' into org_api 2025-05-07 13:46:17 +02:00
Iraq Jaber
25d4f1af78 fixup! Merge branch 'main' into org_api 2025-05-07 13:36:50 +02:00
Iraq Jaber
7383c24931 Merge branch 'main' into org_api 2025-05-07 09:26:32 +02:00
Iraq Jaber
4eb67cebcc fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! adding more tests for ListOrganization() 2025-05-07 09:02:56 +02:00
Iraq Jaber
1a05c41614 fixup! fixup! fixup! fixup! fixup! adding more tests for ListOrganization() 2025-05-06 17:29:26 +02:00
Iraq Jaber
6fa53113c5 fixup! fixup! fixup! adding more tests for ListOrganization() 2025-05-06 14:58:01 +02:00
Iraq Jaber
686079ba66 fixup! fixup! adding more tests for ListOrganization() 2025-05-06 14:04:17 +02:00
Iraq Jaber
1d7c414f87 fixup! adding more tests for ListOrganization() 2025-05-06 09:09:30 +02:00
Iraq Jaber
4f340dc973 adding more tests for ListOrganization() 2025-05-05 15:23:28 +02:00
Iraq Jaber
932cebcd54 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-05 11:17:54 +02:00
Iraq Jaber
76cc92e5d7 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-05 11:03:25 +02:00
Iraq Jaber
c7b6a2f4df fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-05 10:46:41 +02:00
Iraq Jaber
2105dd232a fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-05 09:33:40 +02:00
Iraq Jaber
b8498e89ee fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-04 18:00:38 +02:00
Iraq Jaber
492ac01af4 fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor(api): moving organization API resourced based 2025-05-04 16:58:25 +02:00