gentics / mesh-ui

Gentics Mesh UI
https://getmesh.io
Apache License 2.0
23 stars 27 forks source link

Schema created via API does not appear in the UI #326

Closed scriptex closed 4 years ago

scriptex commented 4 years ago

Gentics Mesh Version, operating system, or hardware.

Problem

I am creating a new schema via the API. The new schema has only a name (which is the only required property).

Then I am assigning this new schema to a project. The schema appears in any subsequent calls to GET /schemas or GET {project}/schemas.

The issue is that the schema does not appear in the UI (the Angular frontend). It also does not appear in the requests to the above routes which the UI makes. When I try to create the same schema from the UI I get an error which says: API Error: Schema name {SCHEMA_NAME} already in use.

Expected behaviour and actual behaviour

I expect that the schema will appear in the UI - in the schemas list and the {project} schemas list.

Any help would be appreciated.

scriptex commented 4 years ago

After further investigation I think i found the issue: The Schema was created via the API using a token generated from an admin user. The user I was logged in with was a regular user. When I logged in with the admin user I was able to see the schema.

So this is probably a feature request or question regarding permissions: How can one assign permissions to a newly created schema via the API? I want everyone to be able to see it and use it.

Jotschi commented 4 years ago

@scriptex You can access the "Permissions" area in the admin UI and select the role and the schema. This allows you to grant permissions (e.g. READ) to other roles. Your non-admin users need to be in a group which has a role assigned to them (e.g. Client Group and Client Role).

Via the API you can use the permissions endpoint of a role to apply permissions.

POST /api/v1/roles/ddcddceb33d648318ddceb33d618314f/permissions/schemas%2F2aa83a2b3cba40a1a83a2b3cba90a1de

{"recursive":false,"permissions":{"create":false,"read":true,"update":false,"delete":false}}
scriptex commented 4 years ago

Thanks for the response and sorry for the delay. I will play with the API to find a way to make this work foe my use case so I will close this issue for now.