This topic is locked

Dynamic Permissions and SaaSDB

5/18/2021 7:53:41 AM
PHPRunner General questions
L
Lance Spurgeon author

When we use dynamic permissions the system automatically creates a view table that maps onto the user list, when using users table as a saas connection, every database will see all the users, how can I limit the user to only see the users linked to their $SESSION["dbname"] database and not all the users in the list.

This is related to the assign users to admin in the admin membership section

admin 5/18/2021

I would say that using Dynamic Permissions in the SaaS project can be a bit cumbersome. If you must to use Dynamic Permissions you need to move permisions tables to the each user's database (as opposed to the main database). Each user will have their own set of permissions table. You just need to make sure that these tables are also created and populated with the initial settings when you create a database for the new user.

HJB 5/19/2021

SAAS APPLICATION DESIGN - MULTITENANT

For inspiration purposes only, as it seems that the keyword "multitenant" is coming nearest to the requirements.

L
Lance Spurgeon author 5/19/2021

I did move the permissions to the users database, but I guess my questions is there is view table that allows admins the user to assign different group level i.e. Managers etc. That view shows all the users in the tenancy database which has to be seperate. Wondered is there a way to filter this view to only show that customers database users. I hope this makes sense?

admin 5/19/2021

Here is the an idea of what you can try. Modify the SQL query of users table this way:

select ... from users <? where dbname = :session.dbname ?>

<? and ?> wrappers are required to make this where clause appear only when this session variable is populated.

Also, after changing this SQL query you need to turn Dynamic Permissions off and on again as this SQL query will be copied to Dynamic Permisions tables when you enable this feature.

L
Lance Spurgeon author 5/20/2021

I will try this and let you know ... thanks Sergey