src/pyams_thesaurus/thesaurus.py
changeset 56 866affb740b3
parent 55 0673948d936e
child 61 5e05ea2cea51
equal deleted inserted replaced
55:0673948d936e 56:866affb740b3
    15 
    15 
    16 # import standard library
    16 # import standard library
    17 import re
    17 import re
    18 
    18 
    19 # import interfaces
    19 # import interfaces
       
    20 from pyams_form.interfaces.form import IFormContextPermissionChecker
    20 from pyams_security.interfaces import IDefaultProtectionPolicy
    21 from pyams_security.interfaces import IDefaultProtectionPolicy
       
    22 from pyams_thesaurus.interfaces import ADMIN_THESAURUS_PERMISSION
    21 from pyams_thesaurus.interfaces.extension import IThesaurusTermExtension
    23 from pyams_thesaurus.interfaces.extension import IThesaurusTermExtension
    22 from pyams_thesaurus.interfaces.loader import IThesaurusLoader
    24 from pyams_thesaurus.interfaces.loader import IThesaurusLoader
    23 from pyams_thesaurus.interfaces.term import IThesaurusTermsContainer, IThesaurusTerm, IThesaurusLoaderTerm
    25 from pyams_thesaurus.interfaces.term import IThesaurusTermsContainer, IThesaurusTerm, IThesaurusLoaderTerm
    24 from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtract, IThesaurusExtractRoles, \
    26 from pyams_thesaurus.interfaces.thesaurus import IThesaurus, IThesaurusExtract, IThesaurusExtractRoles, \
    25     IThesaurusRoles, IThesaurusExtracts, IThesaurusContextManager
    27     IThesaurusRoles, IThesaurusExtracts, IThesaurusContextManager
   268     """Handle removed thesaurus"""
   270     """Handle removed thesaurus"""
   269     manager = event.oldParent
   271     manager = event.oldParent
   270     manager.unregisterUtility(event.object, IThesaurus, name=event.object.name)
   272     manager.unregisterUtility(event.object, IThesaurus, name=event.object.name)
   271 
   273 
   272 
   274 
       
   275 @adapter_config(context=IThesaurus, provides=IFormContextPermissionChecker)
       
   276 class ThesaurusPermissionChecker(ContextAdapter):
       
   277     """Thesaurus edit permission checker"""
       
   278 
       
   279     edit_permission = ADMIN_THESAURUS_PERMISSION
       
   280 
       
   281 
   273 @adapter_config(context=IThesaurus, provides=ITree)
   282 @adapter_config(context=IThesaurus, provides=ITree)
   274 class ThesaurusTreeAdapter(ContextAdapter):
   283 class ThesaurusTreeAdapter(ContextAdapter):
   275     """Thesaurus tree adapter"""
   284     """Thesaurus tree adapter"""
   276 
   285 
   277     def get_root_nodes(self):
   286     def get_root_nodes(self):