Page 1 of 1

allow non-admin to create accounts without admin() priv

Posted: Fri Oct 25, 2024 9:34 pm
by sticcino

Hi,

is there away to allow a user to create accounts without having to give them admin privilege to that table?

the form is pretty locked down for allowing them to edit their own record, but we need a user with a specific userlevel to create accounts with a predefined user level (this user will be able to create accounts that will have a specific use level id that can only view records. this level will be preset and they cannot select anything else or see any other levels or content.

not sure there's a workaround.
thanks


Re: allow non-admin to create accounts without admin() priv

Posted: Sat Oct 26, 2024 12:14 am
by mobhar

That is very easy to do with PHPMaker.

You may simply create a Database View based on your users table to achieve that. Just give Add permission to allow your desired user level to add a new record into that users table.

Of course, you may filter the options for UserLevel field in that Database View that lookup to userlevels table, so that the end-users are able to choose only the allowed user level that you need.

That's only the basic idea. You may enhance it that suits your business logic.


Re: allow non-admin to create accounts without admin() priv

Posted: Sat Oct 26, 2024 2:02 am
by sticcino

Hi Mobhar,

don't think you can add records thru a view... i tried a test there are no crud functions available... gave user every perm on the view as a test, as well as add on the actual table as well


Re: allow non-admin to create accounts without admin() priv

Posted: Sat Oct 26, 2024 2:33 am
by mobhar

As long as your Database View contains one single table, there should be no problem to perform CRUD operation in it.

In addition, make sure also from your Database View inside your PHPMaker project, it has the Primary Key, as well as it has for the original table.