Back

Programatically set Users limit

  • 1
  • Self Hosted
  • Users
develocode777
13 Nov, 2023, 12:44

Can this value be modified programatically like from the cli or from appwrite.json?

TL;DR
The user wants to set the users' session limit to 1 for each individual client's project programmatically. They are looking for a way to authorize the API call automatically without manually taking the 'Cookie' header from a browser session. The suggested solution is to use the Appwrite CLI or create a script that logs in as the console user. There is mention of using the API to change the user session limit, but authorization is still unclear. The user mentions the possibility of managing clients' projects through a database and using the CLI. It is also mentioned that everything the Console does is done through an API, which can be inspected to determine
Drake
13 Nov, 2023, 21:28

FYI everything the Console does is done via some API so you can inspect the network requests to see what the API is.

That said, this API is not totally documented, so it could change.

Why do you need to update it programatically anyways?

develocode777
14 Nov, 2023, 14:16

Thanks, it should be sufficient for now. We need this because we need to provide our clients the posibility to create their own project and customize it.

D5
14 Nov, 2023, 15:41

Why do you want each client having a project?

develocode777
14 Nov, 2023, 15:44

Each client has its own users

D5
14 Nov, 2023, 15:45

I don't think it will be a good idea: how are you going to manage lots of projects you're not owning?

develocode777
15 Nov, 2023, 15:12

we are still working on this, the plan is to have a database with all these clients with all their info and use the cli to manage them

develocode777
15 Nov, 2023, 15:16

@Steven @D5 I see that the api to change the user session limit is like this http://localhost/v1/projects/6552149569ccc0db14a5/auth/max-sessions, but how to authorize the request? I managed with the header 'Cookie':'a_session_console_legacy=...', taken from the browser, but that is not feasable

Drake
15 Nov, 2023, 21:52

What do you mean not feasible?

develocode777
16 Nov, 2023, 08:38

We need to automate the process somehow

D5
16 Nov, 2023, 10:45

Why not doing all of this with only 1 account and a project?

Drake
16 Nov, 2023, 20:38

Sorry I still don't understand the problem

develocode777
17 Nov, 2023, 12:04

We need a way to setup a project programatically for each individual client. When the project is created we need to set the users max session limit to 1 and we can use the api as you suggested but the call to the api needs to authorized and it needs to be automatic, not by manually taking the 'Cookie':'a_session_console_legacy=...' header from a browser session.

Drake
17 Nov, 2023, 21:24

You can create a script that logs in as the console user and does whatever. or you can use the Appwrite CLI.

Everything done in the Console is done via some REST API call which you can do programatically

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more