SquidexClientLibrary Update Singleton Content

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [x] Documentation issue or request

Current behavior

I want to create a new app with the SquidexClientLibrary from nuget. After that I want to copy all contributers, schemas and contents from an existing template-app to the new app. This is all working well but after that I want to set the api client to a role that I can only get the client secret of the “reader”-client so that the api client cannot change content anymore or copy it a second time. Is this possible or should I save the secret of the reader client in another database before I delete him?

I found no method to update a contributers role.

Also it would be great if the methods of the library would have documentation comments. But I know that this would be much work…

Expected behavior

  1. API-Client creates new app
  2. API-Client copies contributers, schemas and contents from “template-app”
  3. API-Client sets own user to readonly, but needs to get the secret of user “reader” in future

Minimal reproduction of the problem

Environment

  • [ ] Self hosted with docker
  • [x] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: SquidexClientLibrary 6.4.0

Browser:

  • [x] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Others:

Hi,

first about comments: The generated clients already have comments, but I need to enable them in the build I guess.

In the IAppsClient you should have all methods that you need, for example this method to change the contributor role: https://github.com/Squidex/squidex/blob/master/backend/tools/TestSuite/TestSuite.ApiTests/AppTests.cs#L169

But if you change the permission you might loose access, so you have to store the secret somewhere.

Hi Sebastian,

thank you for your response.

But It looks like it’s not working. I’m getting this error: “You cannot change your own role.”

Maybe I should not change the user role and make some checks to not changing content on an existing app. This has one advantage: I can still get the secret of the reader client without writing it in another db.

Greetings
Chris

If you are self hosting you can create admin client, I would use this for automation.

Yes, you are right. I think so too, but my team leader said that he want to have the new app readonly for the service I am developing, after creating and copy of content is done. I solved it with proxy classes calling some methods only if the app does not exist. Now everything is working as expected. :+1:

Now I see on github, that there are comments in the generated code. It would be great if they are shown in the next release.

Thank you for your help!

Greetings Chris

1 Like