• Arnaud Fontaine's avatar
    ZODB Components: ModuleSecurityInfo() should also apply to the alias module,... · eabcb211
    Arnaud Fontaine authored
    ZODB Components: ModuleSecurityInfo() should also apply to the alias module, not only to the versioned one.
    
    This fixes an Unauthorized error when GitLoginError is imported from
    erp5.component.module.Git defining ModuleSecurityInfo() for __name__
    (erp5.component.module.erp5_version.Git).
    
    Note that when migrating the content of a Product, ModuleSecurityInfo() first
    parameter must be __name__.
    
    Traceback (innermost last):
      [...]
      Module script, line 1, in BusinessTemplate_handleException
       - <PythonScript at /erp5/BusinessTemplate_handleException used for /erp5/portal_templates/832>
       - Line 1
        from erp5.component.module.Git import GitLoginError
      Module Products.ERP5Type.patches.Restricted, line 305, in guarded_import
        return orig_guarded_import(mname, globals, locals, fromlist, level)
      Module AccessControl.ZopeGuards, line 305, in guarded_import
        raise Unauthorized("import of '%s' is unauthorized" % mname)
    Unauthorized: import of 'erp5.component.module.Git' is unauthorized
    eabcb211
Restricted.py 12.4 KB