Commit 50ae2d8e authored by Vincent Pelletier's avatar Vincent Pelletier

erp5_oauth2_resource: Switch upgrader constraint from id to meta_type

Duplicating the id is bad. Checking the meta_type is not perfect, but it
is one step better.
parent 533f7e55
error_list = []
# XXX: duplicates a value from product/ERP5/ERP5Site.py
# It would be better to check plugin class, and not just its id.
plugin_id = 'erp5_oauth2_resource'
user_folder = context.getPortalObject().acl_users
if plugin_id not in user_folder:
# XXX: does not check plugin personalities registration, but these are
# automaticaly done on plugin creation, so unregistering them should be
for plugin_value in user_folder.objectValues():
# Note: does not check plugin personalities registration, but these are
# automaticly done on plugin creation, so unregistering them should be
# a conscious admin action, that should likely be respected.
# XXX: testing the type would be nicer than testing the meta_type attribute
if getattr(plugin_value, 'meta_type', None) == 'ERP5 OAuth2 Resource Server Plugin':
break
else:
error_list.append('PAS plugin %r does not exist' % (plugin_id, ))
if fixit:
user_folder.manage_addProduct['ERP5Security'].addERP5OAuth2ResourceServerPlugin(
......
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