Commit 67189acc authored by Rafael Monnerat's avatar Rafael Monnerat

*: Introduce User Type List

  In general ERP5, Person is the the unique user provider where you can login with,
  however, other project may implement different user types, like, Compute Node,
  Software Instance, Application Bot or external services.

  Since, the different Users can contains different login types (Certificate Login,
  ERP5 Login, ..), it is only natural to introduce getPortalUserTypeList for handle
  such use case.

  For now, Assignment management is only implemented for Person, so I am not changing
  the ERP5 Security, since it is not exactly mandatory and more specific use cases
  should be consider to change ERP5 Security.

  Said that, the motifivation for this change is not require fork asSecurityGroupIdSet
  whenever an implementation introduce more them one type of user capable of login.
parent 5d126a25
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
<value> <value>
<tuple> <tuple>
<string>node</string> <string>node</string>
<string>user</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
"""Make sure the user has a user id. """Make sure the user has a user id.
Persons that were created before user id were introduced may not have a user id already. Persons (or other user types) that were created before user id were introduced may not have a user id already.
""" """
user = state_change['object'].getParentValue() user = state_change['object'].getParentValue()
if user.getPortalType() == 'Person' and not user.hasUserId(): if user.getPortalType() in user.getPortalUserTypeList() and not user.hasUserId():
user.initUserId() user.initUserId()
...@@ -1812,6 +1812,14 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook ...@@ -1812,6 +1812,14 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
""" """
return self._getPortalGroupedTypeList('login') return self._getPortalGroupedTypeList('login')
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalLoginTypeList')
def getPortalUserTypeList(self):
"""
Returns Login types.
"""
return self._getPortalGroupedTypeList('user')
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'getPortalDataDescriptorTypeList') 'getPortalDataDescriptorTypeList')
def getPortalDataDescriptorTypeList(self): def getPortalDataDescriptorTypeList(self):
......
...@@ -175,7 +175,7 @@ def asSecurityGroupIdSet(category_dict, key_sort=sorted): ...@@ -175,7 +175,7 @@ def asSecurityGroupIdSet(category_dict, key_sort=sorted):
except KeyError: except KeyError:
continue continue
for category_value, is_child_category in category_list: for category_value, is_child_category in category_list:
if category_value.getPortalType() == 'Person': if category_value.getPortalType() in self.getPortalUserTypeList():
user_name = category_value.Person_getUserId() user_name = category_value.Person_getUserId()
if user_name is not None: if user_name is not None:
user_list.append(user_name) user_list.append(user_name)
......
...@@ -313,7 +313,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -313,7 +313,7 @@ class ERP5TypeInformation(XMLObject,
# Document related to a person's assignment or career step # Document related to a person's assignment or career step
'personal_item', 'personal_item',
# Base # Base
'entity', 'login', 'entity', 'login', 'user',
# Core # Core
'domain', 'domain',
# Wendelin # Wendelin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment