author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Thu, 14 Jan 2010 11:13:22 +0100 | |
changeset 4240 | 6109962761f2 |
parent 4139 | 2718f2fd0576 |
child 4252 | 6c4f109c2b03 |
permissions | -rw-r--r-- |
0 | 1 |
"""core CubicWeb schema, but not necessary at bootstrap time |
2 |
||
3 |
:organization: Logilab |
|
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1742
diff
changeset
|
4 |
:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1742
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
8 |
__docformat__ = "restructuredtext en" |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
9 |
_ = unicode |
0 | 10 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
11 |
from yams.buildobjs import (EntityType, RelationType, SubjectRelation, |
2297
4cf57dd80650
missing imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2140
diff
changeset
|
12 |
String, Boolean, Datetime, Password) |
4cf57dd80650
missing imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2140
diff
changeset
|
13 |
from cubicweb.schema import (RQLConstraint, WorkflowableEntityType, |
4cf57dd80650
missing imports
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2140
diff
changeset
|
14 |
ERQLExpression, RRQLExpression) |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
15 |
from cubicweb.schemas import META_ETYPE_PERMS, META_RTYPE_PERMS |
0 | 16 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
17 |
class CWUser(WorkflowableEntityType): |
0 | 18 |
"""define a CubicWeb user""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
19 |
__permissions__ = { |
0 | 20 |
'read': ('managers', 'users', ERQLExpression('X identity U')), |
21 |
'add': ('managers',), |
|
22 |
'delete': ('managers',), |
|
23 |
'update': ('managers', ERQLExpression('X identity U, NOT U in_group G, G name "guests"'),), |
|
24 |
} |
|
25 |
||
26 |
login = String(required=True, unique=True, maxsize=64, |
|
27 |
description=_('unique identifier used to connect to the application')) |
|
28 |
upassword = Password(required=True) # password is a reserved word for mysql |
|
29 |
firstname = String(maxsize=64) |
|
30 |
surname = String(maxsize=64) |
|
31 |
last_login_time = Datetime(description=_('last connection date')) |
|
32 |
# allowing an email to be the primary email of multiple entities is necessary for |
|
1451 | 33 |
# test at least :-/ |
0 | 34 |
primary_email = SubjectRelation('EmailAddress', cardinality='??', |
35 |
description=_('email address to use for notification')) |
|
36 |
use_email = SubjectRelation('EmailAddress', cardinality='*?', composite='subject') |
|
37 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
38 |
in_group = SubjectRelation('CWGroup', cardinality='+*', |
0 | 39 |
constraints=[RQLConstraint('NOT O name "owners"')], |
4139 | 40 |
description=_('groups grant permissions to the user')) |
0 | 41 |
|
42 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
43 |
class EmailAddress(EntityType): |
0 | 44 |
"""an electronic mail address associated to a short alias""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
45 |
__permissions__ = { |
0 | 46 |
'read': ('managers', 'users', 'guests',), # XXX if P use_email X, U has_read_permission P |
47 |
'add': ('managers', 'users',), |
|
48 |
'delete': ('managers', 'owners', ERQLExpression('P use_email X, U has_update_permission P')), |
|
49 |
'update': ('managers', 'owners', ERQLExpression('P use_email X, U has_update_permission P')), |
|
50 |
} |
|
1451 | 51 |
|
0 | 52 |
alias = String(fulltextindexed=True, maxsize=56) |
1451 | 53 |
address = String(required=True, fulltextindexed=True, |
0 | 54 |
indexed=True, unique=True, maxsize=128) |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
55 |
prefered_form = SubjectRelation('EmailAddress', cardinality='?*', |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
56 |
description=_('when multiple addresses are equivalent \ |
0 | 57 |
(such as python-projects@logilab.org and python-projects@lists.logilab.org), set this \ |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
58 |
to indicate which is the preferred form.')) |
0 | 59 |
|
60 |
class use_email(RelationType): |
|
1742
25a765e756c4
fix self on initfunc
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents:
1477
diff
changeset
|
61 |
""" """ |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
62 |
__permissions__ = { |
0 | 63 |
'read': ('managers', 'users', 'guests',), |
64 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
|
65 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
|
66 |
} |
|
67 |
fulltext_container = 'subject' |
|
68 |
||
69 |
class primary_email(RelationType): |
|
70 |
"""the prefered email""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
71 |
__permissions__ = use_email.__permissions__ |
1451 | 72 |
|
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
73 |
class prefered_form(RelationType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
74 |
__permissions__ = { |
0 | 75 |
'read': ('managers', 'users', 'guests',), |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
76 |
# XXX should have update __permissions__ on both subject and object, |
0 | 77 |
# though by doing this we will probably have no way to add |
78 |
# this relation in the web ui. The easiest way to acheive this |
|
79 |
# is probably to be able to have "U has_update_permission O" as |
|
80 |
# RQLConstraint of the relation definition, though this is not yet |
|
81 |
# possible |
|
82 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
|
83 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
|
84 |
} |
|
85 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
86 |
class in_group(RelationType): |
0 | 87 |
"""core relation indicating a user's groups""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
88 |
__permissions__ = META_RTYPE_PERMS |
1451 | 89 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
90 |
class owned_by(RelationType): |
0 | 91 |
"""core relation indicating owners of an entity. This relation |
92 |
implicitly put the owner into the owners group for the entity |
|
93 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
94 |
__permissions__ = { |
0 | 95 |
'read': ('managers', 'users', 'guests'), |
1451 | 96 |
'add': ('managers', RRQLExpression('S owned_by U'),), |
0 | 97 |
'delete': ('managers', RRQLExpression('S owned_by U'),), |
98 |
} |
|
99 |
# 0..n cardinality for entities created by internal session (no attached user) |
|
100 |
# and to support later deletion of a user which has created some entities |
|
101 |
cardinality = '**' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
102 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
103 |
object = 'CWUser' |
1451 | 104 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
105 |
class created_by(RelationType): |
0 | 106 |
"""core relation indicating the original creator of an entity""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
107 |
__permissions__ = { |
0 | 108 |
'read': ('managers', 'users', 'guests'), |
109 |
'add': ('managers',), |
|
110 |
'delete': ('managers',), |
|
111 |
} |
|
112 |
# 0..1 cardinality for entities created by internal session (no attached user) |
|
113 |
# and to support later deletion of a user which has created some entities |
|
1451 | 114 |
cardinality = '?*' |
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
115 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
116 |
object = 'CWUser' |
0 | 117 |
|
1451 | 118 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
119 |
class creation_date(RelationType): |
0 | 120 |
"""creation time of an entity""" |
121 |
cardinality = '11' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
122 |
subject = '*' |
0 | 123 |
object = 'Datetime' |
124 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
125 |
class modification_date(RelationType): |
0 | 126 |
"""latest modification time of an entity""" |
127 |
cardinality = '11' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
128 |
subject = '*' |
0 | 129 |
object = 'Datetime' |
130 |
||
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
131 |
class cwuri(RelationType): |
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
132 |
"""internal entity uri""" |
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
133 |
cardinality = '11' |
2464
926696e38502
usage of '**' is deprecated in RelationType declaration, use '*' instead
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2456
diff
changeset
|
134 |
subject = '*' |
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
135 |
object = 'String' |
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
136 |
|
0 | 137 |
|
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
138 |
# XXX find a better relation name |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
139 |
class for_user(RelationType): |
0 | 140 |
"""link a property to the user which want this property customization. Unless |
141 |
you're a site manager, this relation will be handled automatically. |
|
142 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
143 |
__permissions__ = { |
0 | 144 |
'read': ('managers', 'users', 'guests'), |
145 |
'add': ('managers',), |
|
146 |
'delete': ('managers',), |
|
147 |
} |
|
148 |
inlined = True |
|
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
149 |
subject = 'CWProperty' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
150 |
object = 'CWUser' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
151 |
composite = 'object' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
152 |
cardinality = '?*' |
0 | 153 |
|
154 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
155 |
class CWPermission(EntityType): |
0 | 156 |
"""entity type that may be used to construct some advanced security configuration |
157 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
158 |
__permissions__ = META_ETYPE_PERMS |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
159 |
|
0 | 160 |
name = String(required=True, indexed=True, internationalizable=True, maxsize=100, |
161 |
description=_('name or identifier of the permission')) |
|
162 |
label = String(required=True, internationalizable=True, maxsize=100, |
|
163 |
description=_('distinct label to distinguate between other permission entity of the same name')) |
|
1451 | 164 |
require_group = SubjectRelation('CWGroup', |
0 | 165 |
description=_('groups to which the permission is granted')) |
166 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
167 |
# explicitly add X require_permission CWPermission for each entity that should have |
0 | 168 |
# configurable security |
169 |
class require_permission(RelationType): |
|
170 |
"""link a permission to the entity. This permission should be used in the |
|
171 |
security definition of the entity's type to be useful. |
|
172 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
173 |
__permissions__ = { |
0 | 174 |
'read': ('managers', 'users', 'guests'), |
175 |
'add': ('managers',), |
|
176 |
'delete': ('managers',), |
|
177 |
} |
|
1451 | 178 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
179 |
class require_group(RelationType): |
0 | 180 |
"""used to grant a permission to a group""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
181 |
__permissions__ = { |
0 | 182 |
'read': ('managers', 'users', 'guests'), |
183 |
'add': ('managers',), |
|
184 |
'delete': ('managers',), |
|
185 |
} |
|
186 |
||
1451 | 187 |
|
2434
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
188 |
class ExternalUri(EntityType): |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
189 |
"""a URI representing an object in external data store""" |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
190 |
uri = String(required=True, unique=True, maxsize=256, |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
191 |
description=_('the URI of the object')) |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
192 |
|
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
193 |
class same_as(RelationType): |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
194 |
"""generic relation to specify that an external entity represent the same |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
195 |
object as a local one: |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
196 |
http://www.w3.org/TR/owl-ref/#sameAs-def |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
197 |
|
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
198 |
NOTE: You'll have to explicitly declare which entity types can have a |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
199 |
same_as relation |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
200 |
""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
201 |
__permissions__ = { |
2434
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
202 |
'read': ('managers', 'users', 'guests',), |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
203 |
'add': ('managers', 'users'), |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
204 |
'delete': ('managers', 'owners'), |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
205 |
} |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
206 |
cardinality = '*1' |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
207 |
symetric = True |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
208 |
# NOTE: the 'object = ExternalUri' declaration will still be mandatory |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
209 |
# in the cube's schema. |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
210 |
object = 'ExternalUri' |
1477 | 211 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
212 |
class CWCache(EntityType): |
59
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
213 |
"""a simple cache entity characterized by a name and |
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
214 |
a validity date. |
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
215 |
|
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
216 |
The target application is responsible for updating timestamp |
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
217 |
when necessary to invalidate the cache (typically in hooks). |
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
218 |
|
2656
a93ae0f6c0ad
R [base classes] only AppObject remaning, no more AppRsetObject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2464
diff
changeset
|
219 |
Also, checkout the AppObject.get_cache() method. |
59
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
220 |
""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
221 |
__permissions__ = { |
6
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
222 |
'read': ('managers', 'users', 'guests'), |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
223 |
'add': ('managers',), |
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
224 |
'update': ('managers', 'users',), # XXX |
6
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
225 |
'delete': ('managers',), |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
226 |
} |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
227 |
|
1445
d3c9b075ceb7
set a size constraint on ECache's title
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1281
diff
changeset
|
228 |
name = String(required=True, unique=True, indexed=True, maxsize=128, |
0 | 229 |
description=_('name of the cache')) |
230 |
timestamp = Datetime(default='NOW') |
|
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
231 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
232 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
233 |
# "abtract" relation types, not used in cubicweb itself |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
234 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
235 |
class identical_to(RelationType): |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
236 |
"""identical to""" |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
237 |
symetric = True |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
238 |
__permissions__ = { |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
239 |
'read': ('managers', 'users', 'guests',), |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
240 |
# XXX should have update __permissions__ on both subject and object, |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
241 |
# though by doing this we will probably have no way to add |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
242 |
# this relation in the web ui. The easiest way to acheive this |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
243 |
# is probably to be able to have "U has_update_permission O" as |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
244 |
# RQLConstraint of the relation definition, though this is not yet |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
245 |
# possible |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
246 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
247 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
248 |
} |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
249 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
250 |
class see_also(RelationType): |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
251 |
"""generic relation to link one entity to another""" |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
252 |
symetric = True |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
253 |
__permissions__ = { |
3277
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
254 |
'read': ('managers', 'users', 'guests',), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
255 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
256 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
257 |
} |