The idea behind my authentication plugin is to give users some power on a Plone site (but not too much). We are talking about a huge database of more than one million users.
I was thinking on creating a virtual group similar to Authenticated Users (AuthenticatedUsers) but I have no idea how to implement that.
I'm not providing any way to modify the user properties (that's out of the scope); right now I only need to give them the ability of:
access to forms to request some services
upload files on specific folders (subject to review and approval)
which problem are you trying to solve that Plone doesn't handle out of the box? Perferences can be disabled in portal_actions. A group can be created for your users and used enable access to a form in a certain folder and allow Creator access into a certain folder which has restrictions to only "File" objects.
Another alternative, depending on @hvelarde's comfort with its (security by obscurity might be good enough) implications: use CSS to "hide" some of this based on role. You can write selectors using the userrole-* class names on the body element to modify (or hide) elements on the page based on role:
body.userrole-manager #user-name {
font-size:300%; /* admins have big egos, adjust appropriately */
}
I think I was not very clear on my question; first let me remove the issue about the Preferences link as it can be solved with a condition as @espenmn suggested: by default is set as python:member is not None and I can add a second condition to test if the users doesn't belongs to a special group; that's a little bit more clear now.
so, going back a little bit: how should I do that? according to Products.PlonePAS group interfaces there must be a way to add a user automatically to a group and specify roles for a certain group but I was not able to activate that code.
so, there should be a better way to handle this than creating a normal group and adding the user to it manually.
theoretically, every time the user logs in the site using this PAS plugin it must be added to a special group and every time the user logs out it must be removed from that group.
something similar to the way the special group Authenticated Users works.
It's still unclear Hector, why you would not simply use the Authenticated Users group. The scenario you specify ends up being algorithmically identical to that. Since you apparently don't want that, it seems you may have left out some details that may be relevant to find a solution.
because some users (staff persons) may log in using Plone standard mechanism.
the PAS plugin will give citizens registered in a special database of the municipality access to certain features and I have no way to differentiate among them and staff persons as the authentication server validates if a user is registered and returns only an identifier.
you have multiple ways to.login, one being a new PAS plugin with a lot of users being possible
you want a way to give access to certsin things only to anyone of those logged in only from that PAS plugin
a group would probably be best
Seems you can create a new PAS plugin that only does IGroupIntrospection. Then use it to return the current logged in user as the only member of your special group if they pass some condition, eg have a user property that says they come from that pas authorisation plugin. Should be no problem.having multiple IGroupIntrospection plugins.
BTW this might make a generically useful plugin, autogroup. Consider making the condition a tal expersion so others can use this.
Not sure what that autogroup is used for but it seems to be a group you automatically have which has the same name as your username.
Just saying it would be a nice addition to Products.PlonePAS to have an AutoGroupsWithCondition Plugin that has an additional property of a list of [(groupname,tal-condition)] pairs. This could then be configured via the ZMI (or it could be in the registry).
@hvelarde What kind of criteria you have for those groups? Plone ships with Dynamic Groups Plugin, which allows autogrouping users on the base of TAL expression.
The plugin only assigns groups for users, but does not create group objects. So, with that plugin you need to first create the groups and then you can dynamically assign users to them.
The error message sounds like the user has been assigned group "test", but because there is no "test" group in Plone, it's ignored.