Access control - how to use it?

I was reading about Roles & Privileges and created some roles and privileges. Now I wonder, how can I put that to use? Somehow, there must be a way to identity a user. How does that work and how does authorization take place? A login dialogue? Tokens?

I see no clue in the docs.

Hi,

Are you working on Qodly.com or locally with 4D Server ?

If you are working in Qodly.com, you must assign a Role to each final user. When connecting themselves, the Session will come with the concerned privileges inside (the privileges associated to the role).

If you are working with 4D Server, you can build an authentication page and call a function to run the authentication. You must have a dataclass to associate a role to each user.

If the authentication is OK, you must do a Session.setPrivileges()

with the Role of the user as parameter. Then the privileges associated to this Role will be put in the Session.

Here is an example:

	
exposed Function authenticate($identifier : Text; $password : Text) : Text
	
	var $user : cs.UserEntity
	
	$user:=ds.User.query("mail = :1"; $identifier).first()
	
	If ($user#Null)
		If (Verify password hash($password; $user.passwordHash))
			Session.clearPrivileges()
			Session.setPrivileges(New object("roles"; $user.role; "userName"; $user.firstname+" "+$user.lastname))
			return "OK"
		Else 
			return "Authentication failed: wrong password"
		End if 
	Else 
		return "Authentication failed: wrong user"
	End if 
1 Like

Hello Marie-Sophie,
I am working direktly on Qodly.com

So, I added two other users. I am not sure if this will yield the results I am expecting, as these new users are regular Qodly.com users with regular Qodly accounts.

The users I am looking for are ones that log in to my web app and which will get the roles I was predefining.

Nevertheless, creating users and assigning them roles did not help.

I still see nothing on Chrome but my webapp works just fine in Safari.

Unfortunately, whenever something doesn’t work, there is no error message, it’s all just guesswork.

So, to summarize:
At the moment, I only have a sandbox and not a regular account and I see no means to get one.
My webapp is dysfunctional on Chrome, although Chrome is recommended and Safari is not
I see no way to have a simply login to log in to my particular web app, there is only a login to Qodly and even then I see no difference in visibility or functionality on Safari.

Let me know if there are missing features that prevent me from doing what’s announced. And the documentation is still lacking.

Nevertheless, I am eager to get this resolved as the system itself is just awesome and I want to get this working.

Update: Miraculously, without having made any changes, my webapp works in Chrome again.
The questions regarding users and login remain still open.

Hi Tilman

So, I added two other users. I am not sure if this will yield the results I am expecting, as these new users are regular Qodly.com users with regular Qodly accounts.

This is the proper way. Those users can login to your app: share with them the preview url:

after having defined a preview webform in your app settings:

By following this link, your users will get a Qodly login screen:

They can enter there Qodly.com credentials. Once loggedin, their session will get all privileges of the role you assigned them when you created them.

At the moment, I only have a sandbox and not a regular account and I see no means to get one.

All users, you as a developer or your users, need a qodly.com account to develop or use the final app.

I see no way to have a simply login to log in to my particular web app, there is only a login to Qodly

This is normal. Whether you access Qodly dashboard, Qodly Studio or the Qodly app, you will have to login using your qodly.com account.

Nevertheless, I am eager to get this resolved as the system itself is just awesome and I want to get this working.

Let us know when it is OK for you. Thanks for this feedback!

I still see nothing on Chrome but my webapp works just fine in Safari.

Update: Miraculously, without having made any changes, my webapp works in Chrome again.

I would suspect a cache issue in your Chrome.

Thank you for clarifying.

From your answer I couldn’t really deduce if there is already an option to create a regular app, not just a sandbox. Is this due to Qodly’s beta status?

Hi again Tilman,

Yes. Beta phase only offers sandboxes.
Paid apps are around the corner. Once available, you will be able to clone your sandbox into a paid app without loosing your work.

Would you already have a project ready to go live?

Stay tuned.

Hi Mathieu,

yes, I have a little app that I have developed for our charity. The idea is to manage distributions of clothes, food and hygiene items to homeless people.

For me, it was a nice project to test the feasibility using Qodly for our 4D based application.

Nevertheless, I intend to actually roll out the app for our own purpose as we currently are working with Excel, sticky notes and lots of personalized knowledge. After finishing the functional side, I plan to see how CSS and I get along :slight_smile:

If everything works as planned, we can streamline our processes, which should give us more time to take care of every individual.

1 Like