equal
deleted
inserted
replaced
9 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
9 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
10 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
10 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
11 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
11 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
12 # FOR A PARTICULAR PURPOSE. |
12 # FOR A PARTICULAR PURPOSE. |
13 # |
13 # |
|
14 from pyams_form.interfaces.form import IFormContextPermissionChecker |
|
15 from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION |
14 |
16 |
15 __docformat__ = 'restructuredtext' |
17 __docformat__ = 'restructuredtext' |
16 |
18 |
17 |
19 |
18 # import standard library |
20 # import standard library |
31 from persistent import Persistent |
33 from persistent import Persistent |
32 from pyams_security.property import RolePrincipalsFieldProperty |
34 from pyams_security.property import RolePrincipalsFieldProperty |
33 from pyams_security.security import ProtectedObject |
35 from pyams_security.security import ProtectedObject |
34 from pyams_skin.configuration import Configuration, StaticConfiguration, BackOfficeConfiguration |
36 from pyams_skin.configuration import Configuration, StaticConfiguration, BackOfficeConfiguration |
35 from pyams_skin.skin import UserSkinnableContent |
37 from pyams_skin.skin import UserSkinnableContent |
36 from pyams_utils.adapter import adapter_config |
38 from pyams_utils.adapter import adapter_config, ContextAdapter |
37 from pyams_utils.registry import get_utility |
39 from pyams_utils.registry import get_utility |
38 from pyams_utils.site import BaseSiteRoot |
40 from pyams_utils.site import BaseSiteRoot |
39 from pyams_utils.traversing import get_parent |
41 from pyams_utils.traversing import get_parent |
40 from pyramid.events import subscriber |
42 from pyramid.events import subscriber |
41 from zope.interface import implementer, Interface |
43 from zope.interface import implementer, Interface |
103 group = security.get_principal(principal_id, info=False) |
105 group = security.get_principal(principal_id, info=False) |
104 if event.principal_id not in group.principals: |
106 if event.principal_id not in group.principals: |
105 group.principals = group.principals | {event.principal_id} |
107 group.principals = group.principals | {event.principal_id} |
106 |
108 |
107 |
109 |
|
110 @adapter_config(context=ISiteRoot, provides=IFormContextPermissionChecker) |
|
111 class SiteRootPermissionChecker(ContextAdapter): |
|
112 """Site root permission checker""" |
|
113 |
|
114 @property |
|
115 def edit_permission(self): |
|
116 return MANAGE_SYSTEM_PERMISSION |
|
117 |
|
118 |
108 # |
119 # |
109 # Tools configuration |
120 # Tools configuration |
110 # |
121 # |
111 |
122 |
112 @implementer(ISiteRootToolsConfiguration) |
123 @implementer(ISiteRootToolsConfiguration) |