User Id for anonymous?

Hello dear Plone community,

does an anonymous user (i.e. not logged in, like a normal visitor) actually have his own Id ?

If there is an Id for this anonymous user, how is it syntactically structured ?
And how long does a user keep this id ?

I would be very pleased to receive any information.

Thank you in advance.

Greetings :slight_smile:

An anonymous user is represented by a user object; in modern Zope versions, the getId method of this object returns None.

Even if it would not return None, the value would not be a user id in the narrow meaning because it would not identify individual users (but a whole class of users).

1 Like

Hello, thank you for your answer. :+1:

But how can I assign anonymous users? Is this possible at all in Plone/Zope ?

Greetings :slight_smile:

For what purpose do you want to "assign users"?

Should this be to grant permissions, then you could use that anonymous users have the role Anonymous. Granting a permission to this roles means that anonymous users have this permission.

Some permissions are controlled by a workflow; i.e. workflow actions can change their grants. You may need to change the workflow definition to control the permission to role mapping. In case, you want to control those permissions locally, there is Products.CMFPlacefulWorkflow. Other permissions can be controlled via manageAccess (a ZMI action, typically hidden to avoid unreliable modification of workflow controlled permissions).

I would like to design a message distribution list and each user can compile his messages according to his wishes. And I need something to keep the users apart.

Obviously, a service you can only provide to authenticated users.

Plone provides functionality to distinguish between anonymous and authenticated users (independent of the user id). When I remember right, this information is provided via one of the plone views - but likely, it is also available via plone.api; read the documentation.

Obviously, a service you can only provide to authenticated users.

I would like to offer the service to everyone who comes to the site, but then I can't distinguish between them, as I understand it now ?!

Very sad :frowning:

You can after they have authenticated themselves.

1 Like