src/pyams_content/shared/common/interfaces/__init__.py
changeset 285 e10f82e4874e
parent 277 9649f8ce3b1c
child 298 42f146b4d946
equal deleted inserted replaced
284:796b6f241aff 285:e10f82e4874e
    31 from zope.schema import Choice, Bool, Text, TextLine
    31 from zope.schema import Choice, Bool, Text, TextLine
    32 
    32 
    33 from pyams_content import _
    33 from pyams_content import _
    34 
    34 
    35 
    35 
    36 class ISharedSite(IBaseContent):
    36 class IBaseContentManagerRoles(Interface):
    37     """Shared site interface"""
       
    38 
       
    39     containers(ISiteRoot)
       
    40 
       
    41 
       
    42 class ISharedToolContainer(IBaseContent, IContainer):
       
    43     """Shared tools container"""
       
    44 
       
    45     containers(ISiteRoot)
       
    46     contains('.ISharedTool')
       
    47 
       
    48 
       
    49 class IBaseSharedTool(IBaseContent, IContainer):
       
    50     """Base shared tool interface"""
       
    51 
       
    52     containers(ISharedToolContainer)
       
    53 
       
    54     shared_content_workflow = Choice(title=_("Workflow name"),
       
    55                                      description=_("Name of workflow utility used to manage tool contents"),
       
    56                                      vocabulary="PyAMS workflows",
       
    57                                      default="PyAMS default workflow")
       
    58 
       
    59 
       
    60 class ISharedTool(IBaseSharedTool):
       
    61     """Shared tool interface"""
       
    62 
       
    63     contains('.ISharedContent')
       
    64 
       
    65     shared_content_type = Attribute("Shared data content type")
       
    66     shared_content_factory = Attribute("Shared data factory")
       
    67 
       
    68 
       
    69 class ISharedToolRoles(Interface):
       
    70     """Shared tool roles interface"""
    37     """Shared tool roles interface"""
    71 
    38 
    72     webmasters = PrincipalsSet(title=_("Webmasters"),
    39     webmasters = PrincipalsSet(title=_("Webmasters"),
    73                                description=_("Webmasters can handle all contents, including published ones"),
    40                                description=_("Webmasters can handle all contents, including published ones"),
    74                                role_id=WEBMASTER_ROLE,
    41                                role_id=WEBMASTER_ROLE,
    88 
    55 
    89     contributors = PrincipalsSet(title=_("Contributors"),
    56     contributors = PrincipalsSet(title=_("Contributors"),
    90                                  description=_("Contributors are users which are allowed to create new contents"),
    57                                  description=_("Contributors are users which are allowed to create new contents"),
    91                                  role_id=CONTRIBUTOR_ROLE,
    58                                  role_id=CONTRIBUTOR_ROLE,
    92                                  required=False)
    59                                  required=False)
       
    60 
       
    61 
       
    62 class ISharedSite(IBaseContent):
       
    63     """Shared site interface"""
       
    64 
       
    65     containers(ISiteRoot)
       
    66 
       
    67 
       
    68 class ISharedToolContainer(IBaseContent, IContainer):
       
    69     """Shared tools container"""
       
    70 
       
    71     containers(ISiteRoot)
       
    72     contains('.ISharedTool')
       
    73 
       
    74 
       
    75 class IBaseSharedTool(IBaseContent, IContainer):
       
    76     """Base shared tool interface"""
       
    77 
       
    78     containers(ISharedToolContainer)
       
    79 
       
    80     shared_content_workflow = Choice(title=_("Workflow name"),
       
    81                                      description=_("Name of workflow utility used to manage tool contents"),
       
    82                                      vocabulary="PyAMS workflows",
       
    83                                      default="PyAMS default workflow")
       
    84 
       
    85 
       
    86 class ISharedTool(IBaseSharedTool):
       
    87     """Shared tool interface"""
       
    88 
       
    89     contains('.ISharedContent')
       
    90 
       
    91     shared_content_type = Attribute("Shared data content type")
       
    92     shared_content_factory = Attribute("Shared data factory")
       
    93 
       
    94 
       
    95 class ISharedToolRoles(IBaseContentManagerRoles):
       
    96     """Shared tool roles"""
    93 
    97 
    94 
    98 
    95 class IWfSharedContent(IBaseContent):
    99 class IWfSharedContent(IBaseContent):
    96     """Shared content interface"""
   100     """Shared content interface"""
    97 
   101 
   214     def get_restrictions(self, principal):
   218     def get_restrictions(self, principal):
   215         """Get manager restrictions for given principal"""
   219         """Get manager restrictions for given principal"""
   216 
   220 
   217     def set_restrictions(self, principal, restrictions):
   221     def set_restrictions(self, principal, restrictions):
   218         """Set manager restrictions for given principal"""
   222         """Set manager restrictions for given principal"""
       
   223 
       
   224     def drop_restrictions(self, principal):
       
   225         """Drop manager restrictions for given principal"""