author | David Douard <david.douard@logilab.fr> |
Fri, 03 Jul 2015 14:07:53 +0200 | |
changeset 10499 | d0907690af55 |
parent 10411 | 4ee15441f2eb |
child 10624 | 48e54aabcd55 |
permissions | -rw-r--r-- |
8190
2a3c1b787688
[vreg] move base registry implementation to logilab.common. Closes #1916014
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
8158
diff
changeset
|
1 |
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
2 |
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
3 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
4 |
# This file is part of CubicWeb. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
5 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
6 |
# CubicWeb is free software: you can redistribute it and/or modify it under the |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
7 |
# terms of the GNU Lesser General Public License as published by the Free |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
8 |
# Software Foundation, either version 2.1 of the License, or (at your option) |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
9 |
# any later version. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
10 |
# |
5424
8ecbcbff9777
replace logilab-common by CubicWeb in disclaimer
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5421
diff
changeset
|
11 |
# CubicWeb is distributed in the hope that it will be useful, but WITHOUT |
5421
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
13 |
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
14 |
# details. |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
15 |
# |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
16 |
# You should have received a copy of the GNU Lesser General Public License along |
8167de96c523
proper licensing information (LGPL-2.1). Hope I get it right this time.
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4759
diff
changeset
|
17 |
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
5896 | 18 |
"""core CubicWeb schema, but not necessary at bootstrap time""" |
0 | 19 |
|
20 |
__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
|
21 |
_ = unicode |
0 | 22 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
23 |
from yams.buildobjs import (EntityType, RelationType, RelationDefinition, |
7456
c54038622fc9
[datafeed] use a boolean flag on CWSource to ensure we don't have concurrent synchronizations. Closes #1725690
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7399
diff
changeset
|
24 |
SubjectRelation, |
7927
44d6e41c0b62
[schema] add missing import (trigger warning)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7922
diff
changeset
|
25 |
String, TZDatetime, Datetime, Password, Interval, |
10371
88577b10b31e
[schema] add a unique index on cwuri
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9541
diff
changeset
|
26 |
Boolean, UniqueConstraint) |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
27 |
from cubicweb.schema import ( |
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
28 |
RQLConstraint, WorkflowableEntityType, ERQLExpression, RRQLExpression, |
10386
82071f767cb8
[schemas] cwuri should be read-only
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9541
diff
changeset
|
29 |
PUB_SYSTEM_ENTITY_PERMS, PUB_SYSTEM_REL_PERMS, PUB_SYSTEM_ATTR_PERMS, |
82071f767cb8
[schemas] cwuri should be read-only
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9541
diff
changeset
|
30 |
RO_ATTR_PERMS) |
0 | 31 |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
32 |
class CWUser(WorkflowableEntityType): |
0 | 33 |
"""define a CubicWeb user""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
34 |
__permissions__ = { |
0 | 35 |
'read': ('managers', 'users', ERQLExpression('X identity U')), |
36 |
'add': ('managers',), |
|
37 |
'delete': ('managers',), |
|
38 |
'update': ('managers', ERQLExpression('X identity U, NOT U in_group G, G name "guests"'),), |
|
39 |
} |
|
40 |
||
41 |
login = String(required=True, unique=True, maxsize=64, |
|
42 |
description=_('unique identifier used to connect to the application')) |
|
43 |
upassword = Password(required=True) # password is a reserved word for mysql |
|
44 |
firstname = String(maxsize=64) |
|
45 |
surname = String(maxsize=64) |
|
7922
d307c3817782
[repository] use utcnow instead of now for some internal timetamps (closes #1988458)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7921
diff
changeset
|
46 |
last_login_time = TZDatetime(description=_('last connection date')) |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
47 |
in_group = SubjectRelation('CWGroup', cardinality='+*', |
0 | 48 |
constraints=[RQLConstraint('NOT O name "owners"')], |
49 |
description=_('groups grant permissions to the user')) |
|
50 |
||
51 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
52 |
class EmailAddress(EntityType): |
0 | 53 |
"""an electronic mail address associated to a short alias""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
54 |
__permissions__ = { |
8158
2ee254e74382
[schema] restrictive email address read permission. Closes #2148141
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7995
diff
changeset
|
55 |
# application that wishes public email, or use it for something else |
2ee254e74382
[schema] restrictive email address read permission. Closes #2148141
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7995
diff
changeset
|
56 |
# than users (eg Company, Person), should explicitly change permissions |
2ee254e74382
[schema] restrictive email address read permission. Closes #2148141
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7995
diff
changeset
|
57 |
'read': ('managers', ERQLExpression('U use_email X')), |
0 | 58 |
'add': ('managers', 'users',), |
59 |
'delete': ('managers', 'owners', ERQLExpression('P use_email X, U has_update_permission P')), |
|
60 |
'update': ('managers', 'owners', ERQLExpression('P use_email X, U has_update_permission P')), |
|
61 |
} |
|
1451 | 62 |
|
0 | 63 |
alias = String(fulltextindexed=True, maxsize=56) |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
64 |
address = String(required=True, fulltextindexed=True, |
0 | 65 |
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
|
66 |
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
|
67 |
description=_('when multiple addresses are equivalent \ |
0 | 68 |
(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
|
69 |
to indicate which is the preferred form.')) |
0 | 70 |
|
71 |
class use_email(RelationType): |
|
7733
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
72 |
fulltext_container = 'subject' |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
73 |
|
7739
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
74 |
|
7733
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
75 |
class use_email_relation(RelationDefinition): |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
76 |
"""user's email account""" |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
77 |
name = "use_email" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
78 |
__permissions__ = { |
0 | 79 |
'read': ('managers', 'users', 'guests',), |
80 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
|
81 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
|
82 |
} |
|
7733
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
83 |
subject = "CWUser" |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
84 |
object = "EmailAddress" |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
85 |
cardinality = '*?' |
432e1f0d4857
[schema] use definition for `use_email` relation instead of type declaration (closes: #1894929)
Julien Jehannet <julien.jehannet@logilab.fr>
parents:
7690
diff
changeset
|
86 |
composite = 'subject' |
0 | 87 |
|
7739
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
88 |
|
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
89 |
class primary_email(RelationDefinition): |
7745
1013c31bfbee
[.po generation] closes #1902315: c i18ncube doesn't consider relation definition description
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7739
diff
changeset
|
90 |
"""the prefered email""" |
7739
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
91 |
__permissions__ = { |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
92 |
'read': ('managers', 'users', 'guests',), |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
93 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
94 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
95 |
} |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
96 |
subject = "CWUser" |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
97 |
object = "EmailAddress" |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
98 |
cardinality = '??' |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
99 |
constraints= [RQLConstraint('S use_email O')] |
12a802ba5311
[base schema] do similar changes as use_email for primary_email
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7733
diff
changeset
|
100 |
|
1451 | 101 |
|
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
102 |
class prefered_form(RelationType): |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
103 |
__permissions__ = { |
0 | 104 |
'read': ('managers', 'users', 'guests',), |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
105 |
# XXX should have update __permissions__ on both subject and object, |
0 | 106 |
# though by doing this we will probably have no way to add |
107 |
# this relation in the web ui. The easiest way to acheive this |
|
108 |
# is probably to be able to have "U has_update_permission O" as |
|
109 |
# RQLConstraint of the relation definition, though this is not yet |
|
110 |
# possible |
|
111 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
|
112 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
|
113 |
} |
|
114 |
||
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
115 |
class in_group(RelationType): |
0 | 116 |
"""core relation indicating a user's groups""" |
4754
6bf17f810975
[schema] new constants for permissions definitions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4719
diff
changeset
|
117 |
__permissions__ = PUB_SYSTEM_REL_PERMS |
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 owned_by(RelationType): |
0 | 120 |
"""core relation indicating owners of an entity. This relation |
121 |
implicitly put the owner into the owners group for the entity |
|
122 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
123 |
__permissions__ = { |
0 | 124 |
'read': ('managers', 'users', 'guests'), |
1451 | 125 |
'add': ('managers', RRQLExpression('S owned_by U'),), |
0 | 126 |
'delete': ('managers', RRQLExpression('S owned_by U'),), |
127 |
} |
|
128 |
# 0..n cardinality for entities created by internal session (no attached user) |
|
129 |
# and to support later deletion of a user which has created some entities |
|
130 |
cardinality = '**' |
|
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
131 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
132 |
object = 'CWUser' |
1451 | 133 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
134 |
class created_by(RelationType): |
0 | 135 |
"""core relation indicating the original creator of an entity""" |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
136 |
__permissions__ = { |
0 | 137 |
'read': ('managers', 'users', 'guests'), |
138 |
'add': ('managers',), |
|
139 |
'delete': ('managers',), |
|
140 |
} |
|
141 |
# 0..1 cardinality for entities created by internal session (no attached user) |
|
142 |
# and to support later deletion of a user which has created some entities |
|
1451 | 143 |
cardinality = '?*' |
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
144 |
subject = '*' |
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
1303
diff
changeset
|
145 |
object = 'CWUser' |
0 | 146 |
|
1451 | 147 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
148 |
class creation_date(RelationType): |
0 | 149 |
"""creation time of an entity""" |
4755
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
150 |
__permissions__ = PUB_SYSTEM_ATTR_PERMS |
0 | 151 |
cardinality = '11' |
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
152 |
subject = '*' |
0 | 153 |
object = 'Datetime' |
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 modification_date(RelationType): |
0 | 156 |
"""latest modification time of an entity""" |
4755
13a5d3a7410e
[schema] tweaks meta-relations and schema/workflow entities attributes permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4754
diff
changeset
|
157 |
__permissions__ = PUB_SYSTEM_ATTR_PERMS |
0 | 158 |
cardinality = '11' |
2438
576f4d51f826
[cleanup] fix deprecation warnings
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
2297
diff
changeset
|
159 |
subject = '*' |
0 | 160 |
object = 'Datetime' |
161 |
||
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
162 |
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
|
163 |
"""internal entity uri""" |
10386
82071f767cb8
[schemas] cwuri should be read-only
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9541
diff
changeset
|
164 |
__permissions__ = RO_ATTR_PERMS |
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
165 |
cardinality = '11' |
2464
926696e38502
usage of '**' is deprecated in RelationType declaration, use '*' instead
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2456
diff
changeset
|
166 |
subject = '*' |
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
167 |
object = 'String' |
10371
88577b10b31e
[schema] add a unique index on cwuri
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
9541
diff
changeset
|
168 |
constraints = [UniqueConstraint()] |
2456
aa25d6b244c8
new cwuri metadata + a few tests fixes on the way
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2441
diff
changeset
|
169 |
|
0 | 170 |
|
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
171 |
# 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
|
172 |
class for_user(RelationType): |
0 | 173 |
"""link a property to the user which want this property customization. Unless |
174 |
you're a site manager, this relation will be handled automatically. |
|
175 |
""" |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
176 |
__permissions__ = { |
0 | 177 |
'read': ('managers', 'users', 'guests'), |
178 |
'add': ('managers',), |
|
179 |
'delete': ('managers',), |
|
180 |
} |
|
181 |
inlined = True |
|
3392
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
182 |
subject = 'CWProperty' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
183 |
object = 'CWUser' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
184 |
composite = 'object' |
36bcf206e157
[schema] CWProperty is required at bootstrap time
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
3277
diff
changeset
|
185 |
cardinality = '?*' |
0 | 186 |
|
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 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
193 |
|
2434
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
194 |
class same_as(RelationType): |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
195 |
"""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
|
196 |
object as a local one: |
ed85d69576b4
add sameAs support in cubicweb standard schema
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2297
diff
changeset
|
197 |
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
|
198 |
""" |
4535
71c86a315a9a
update translatable docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4467
diff
changeset
|
199 |
#NOTE: You'll have to explicitly declare which entity types can have a |
71c86a315a9a
update translatable docstring
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4467
diff
changeset
|
200 |
#same_as relation |
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 |
} |
5577
4e3ca117c275
[schema] fix same_as cardinality and bump Bookmark.path max length to approximative max url size
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5424
diff
changeset
|
206 |
cardinality = '**' |
4467
0e73d299730a
fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
207 |
symmetric = True |
2434
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 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
212 |
|
2140
1cba3393ba01
update schema definition to avoid deprecation warning with new yams api
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
1977
diff
changeset
|
213 |
class CWCache(EntityType): |
59
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
214 |
"""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
|
215 |
a validity date. |
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
216 |
|
9660bd221553
ECache should be a meta entity
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
6
diff
changeset
|
217 |
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
|
218 |
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
|
219 |
|
2656
a93ae0f6c0ad
R [base classes] only AppObject remaning, no more AppRsetObject
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2464
diff
changeset
|
220 |
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
|
221 |
""" |
4759 | 222 |
# XXX only handle by hooks, shouldn't be readable/editable at all through |
223 |
# the ui and so no permissions should be granted, no? |
|
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
224 |
__permissions__ = { |
6
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
225 |
'read': ('managers', 'users', 'guests'), |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
226 |
'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
|
227 |
'update': ('managers', 'users',), # XXX |
6
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
228 |
'delete': ('managers',), |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
229 |
} |
29ab115b9fcb
change permissions for Ecache
Stephanie Marcu <stephanie.marcu@logilab.fr>
parents:
0
diff
changeset
|
230 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
231 |
name = String(required=True, unique=True, maxsize=128, |
0 | 232 |
description=_('name of the cache')) |
7922
d307c3817782
[repository] use utcnow instead of now for some internal timetamps (closes #1988458)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7921
diff
changeset
|
233 |
timestamp = TZDatetime(default='NOW') |
3204
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 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
236 |
class CWSource(EntityType): |
6853
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
237 |
__permissions__ = { |
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
238 |
'read': ('managers', 'users', 'guests'), |
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
239 |
'add': ('managers',), |
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
240 |
'update': ('managers',), |
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
241 |
'delete': ('managers',), |
584679872fd7
[schema] fix CWSource permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6622
diff
changeset
|
242 |
} |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
243 |
name = String(required=True, unique=True, maxsize=128, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
244 |
description=_('name of the source')) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
245 |
type = String(required=True, maxsize=20, description=_('type of the source')) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
246 |
config = String(description=_('source\'s configuration. One key=value per ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
247 |
'line, authorized keys depending on the ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
248 |
'source\'s type'), |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
249 |
__permissions__={ |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
250 |
'read': ('managers',), |
9541
e8040107b97e
[schema] explicitly declare 'add' permissions for a couple attributes
Julien Cristau <julien.cristau@logilab.fr>
parents:
8190
diff
changeset
|
251 |
'add': ('managers',), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
252 |
'update': ('managers',), |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
253 |
}) |
6957
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
254 |
# put this here and not in a subclass even if it's only for some sources |
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
255 |
# since having subclasses on generic relation (cw_source) double the number |
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
256 |
# of rdef in the schema, and make ms planning harder since queries solutions |
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
257 |
# may changes when sources are specified |
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
258 |
url = String(description=_('URLs from which content will be imported. You can put one url per line')) |
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
259 |
parser = String(description=_('parser to use to extract entities from content retrieved at given URLs.')) |
7922
d307c3817782
[repository] use utcnow instead of now for some internal timetamps (closes #1988458)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7921
diff
changeset
|
260 |
latest_retrieval = TZDatetime(description=_('latest synchronization time')) |
7930
664d52cb936d
[schema] drop erroneous default on CWSource.in_synchronization. Closes #1990585
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7927
diff
changeset
|
261 |
in_synchronization = TZDatetime(description=_('start timestamp of the currently in synchronization, or NULL when no synchronization in progress.')) |
7921
a93e2ed5877a
[datafeed] add max-lifetime for concurrent synchronization lock (closes #1908676)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7826
diff
changeset
|
262 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
263 |
|
6942
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
264 |
ENTITY_MANAGERS_PERMISSIONS = { |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
265 |
'read': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
266 |
'add': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
267 |
'update': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
268 |
'delete': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
269 |
} |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
270 |
RELATION_MANAGERS_PERMISSIONS = { |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
271 |
'read': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
272 |
'add': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
273 |
'delete': ('managers',), |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
274 |
} |
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
275 |
|
6957
ffda12be2e9f
[repository] #1460066: backport datafeed cube as cubicweb source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6944
diff
changeset
|
276 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
277 |
class CWSourceHostConfig(EntityType): |
6942
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
278 |
__permissions__ = ENTITY_MANAGERS_PERMISSIONS |
6622
27402fe6a94a
[core schema] CWSourceHostConfig.match_host only unique per source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
279 |
__unique_together__ = [('match_host', 'cw_host_config_of')] |
27402fe6a94a
[core schema] CWSourceHostConfig.match_host only unique per source
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6427
diff
changeset
|
280 |
match_host = String(required=True, maxsize=128, |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
281 |
description=_('regexp matching host(s) to which this config applies')) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
282 |
config = String(required=True, |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
283 |
description=_('Source\'s configuration for a particular host. ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
284 |
'One key=value per line, authorized keys ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
285 |
'depending on the source\'s type, overriding ' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
286 |
'values defined on the source.'), |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
287 |
__permissions__={ |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
288 |
'read': ('managers',), |
9541
e8040107b97e
[schema] explicitly declare 'add' permissions for a couple attributes
Julien Cristau <julien.cristau@logilab.fr>
parents:
8190
diff
changeset
|
289 |
'add': ('managers',), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
290 |
'update': ('managers',), |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
291 |
}) |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
292 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
293 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
294 |
class cw_host_config_of(RelationDefinition): |
6942
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
295 |
__permissions__ = RELATION_MANAGERS_PERMISSIONS |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
296 |
subject = 'CWSourceHostConfig' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
297 |
object = 'CWSource' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
298 |
cardinality = '1*' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
299 |
composite = 'object' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
300 |
inlined = True |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
301 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
302 |
class cw_source(RelationDefinition): |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
303 |
__permissions__ = { |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
304 |
'read': ('managers', 'users', 'guests'), |
7399
972ed1843bd8
[multi-sources] support for moving an entity from an external source (closes #343818)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
305 |
'add': ('managers',), |
972ed1843bd8
[multi-sources] support for moving an entity from an external source (closes #343818)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6957
diff
changeset
|
306 |
'delete': ('managers',), |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
307 |
} |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
308 |
subject = '*' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
309 |
object = 'CWSource' |
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
310 |
cardinality = '1*' |
6942
18bdddd3740f
[source schema] fix permission pb on cw_host_config_of relation + add composite on cw_source, so entities from a source are properly removed when the source is removed
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6882
diff
changeset
|
311 |
composite = 'object' |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
312 |
|
7995
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
313 |
|
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
314 |
class CWDataImport(EntityType): |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
315 |
__permissions__ = ENTITY_MANAGERS_PERMISSIONS |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
316 |
start_timestamp = TZDatetime() |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
317 |
end_timestamp = TZDatetime() |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
318 |
log = String() |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
319 |
status = String(required=True, internationalizable=True, indexed=True, |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
320 |
default='in progress', |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
321 |
vocabulary=[_('in progress'), _('success'), _('failed')]) |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
322 |
|
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
323 |
class cw_import_of(RelationDefinition): |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
324 |
__permissions__ = RELATION_MANAGERS_PERMISSIONS |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
325 |
subject = 'CWDataImport' |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
326 |
object = 'CWSource' |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
327 |
cardinality = '1*' |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
328 |
composite = 'object' |
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
329 |
|
9a9f35ef418c
Record a log of datafeed source imports (closes #2026097)
Julien Cristau <julien.cristau@logilab.fr>
parents:
7931
diff
changeset
|
330 |
|
6944
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
331 |
class CWSourceSchemaConfig(EntityType): |
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
332 |
__permissions__ = ENTITY_MANAGERS_PERMISSIONS |
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
333 |
cw_for_source = SubjectRelation( |
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
334 |
'CWSource', inlined=True, cardinality='1*', composite='object', |
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
335 |
__permissions__=RELATION_MANAGERS_PERMISSIONS) |
0cf10429ad39
[sources] rewrite the way pyrorql mapping are stored in the database so it can be reused for other sources (eg datafeed+cwxml)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
6942
diff
changeset
|
336 |
options = String(description=_('allowed options depends on the source type')) |
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
337 |
|
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
338 |
|
7690
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
339 |
class rtype_cw_schema(RelationDefinition): |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
340 |
__permissions__ = RELATION_MANAGERS_PERMISSIONS |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
341 |
name = 'cw_schema' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
342 |
subject = 'CWSourceSchemaConfig' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
343 |
object = ('CWEType', 'CWRType') |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
344 |
inlined = True |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
345 |
cardinality = '1*' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
346 |
composite = 'object' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
347 |
constraints = [RQLConstraint('NOT O final TRUE')] |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
348 |
|
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
349 |
class rdef_cw_schema(RelationDefinition): |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
350 |
__permissions__ = RELATION_MANAGERS_PERMISSIONS |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
351 |
name = 'cw_schema' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
352 |
subject = 'CWSourceSchemaConfig' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
353 |
object = 'CWRelation' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
354 |
inlined = True |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
355 |
cardinality = '1*' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
356 |
composite = 'object' |
015396b6e417
[schema] rephrase relation definition since constraint doesn't apply to CWRelation
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7688
diff
changeset
|
357 |
|
6427
c8a5ac2d1eaa
[schema / sources] store data sources as cubicweb entities
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5896
diff
changeset
|
358 |
# "abtract" relation types, no definition in cubicweb itself ################### |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
359 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
360 |
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
|
361 |
"""identical to""" |
4467
0e73d299730a
fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
362 |
symmetric = True |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
363 |
__permissions__ = { |
3204
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
364 |
'read': ('managers', 'users', 'guests',), |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
365 |
# 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
|
366 |
# 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
|
367 |
# 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
|
368 |
# 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
|
369 |
# 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
|
370 |
# possible |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
371 |
'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
|
372 |
'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
|
373 |
} |
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
374 |
|
0b766b8a13e1
#370578: change EmailAddress identical_to/canonical to prefered_form
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
2656
diff
changeset
|
375 |
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
|
376 |
"""generic relation to link one entity to another""" |
4467
0e73d299730a
fix long-waiting symetric typo: should be spelled symmetric. Add auto database migration on schema deserialization
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
4252
diff
changeset
|
377 |
symmetric = True |
3877
7ca53fc72a0a
reldefsecurity branch :
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3277
diff
changeset
|
378 |
__permissions__ = { |
3277
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
379 |
'read': ('managers', 'users', 'guests',), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
380 |
'add': ('managers', RRQLExpression('U has_update_permission S'),), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
381 |
'delete': ('managers', RRQLExpression('U has_update_permission S'),), |
4fdb165ae3de
fix see_also permissions
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
3204
diff
changeset
|
382 |
} |
7797
a71618a75b53
backport stable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7782
diff
changeset
|
383 |
|
a71618a75b53
backport stable
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
7782
diff
changeset
|
384 |