Browse Source

fixed model for rights

sferot 11 years ago
parent
commit
72795e5884
2 changed files with 11 additions and 12 deletions
  1. 9 1
      pboard/pboard/model/auth.py
  2. 2 11
      pboard/pboard/model/data.py

+ 9 - 1
pboard/pboard/model/auth.py View File

54
     created = Column(DateTime, default=datetime.now)
54
     created = Column(DateTime, default=datetime.now)
55
     personnal_group = Column(Boolean)
55
     personnal_group = Column(Boolean)
56
     users = relation('User', secondary=user_group_table, backref='groups')
56
     users = relation('User', secondary=user_group_table, backref='groups')
57
-    rights = relation('Rights', secondary=group_node_table, backref='groups')
58
 
57
 
59
     def __repr__(self):
58
     def __repr__(self):
60
         return '<Group: name=%s>' % repr(self.group_name)
59
         return '<Group: name=%s>' % repr(self.group_name)
155
         hash.update((password + self.password[:64]).encode('utf-8'))
154
         hash.update((password + self.password[:64]).encode('utf-8'))
156
         return self.password[64:] == hash.hexdigest()
155
         return self.password[64:] == hash.hexdigest()
157
 
156
 
157
+class Rights(DeclarativeBase):
158
+    __tablename__ = 'pod_group_node'
159
+
160
+    group_id = Column(Integer, ForeignKey('pod_group.group_id'), autoincrement=True, primary_key=True)
161
+    node_id = Column(Integer, ForeignKey('pod_nodes.node_id'), autoincrement=True, primary_key=True)
162
+    rights = Column(Integer)
163
+
164
+    groups = relation('PBNode')
165
+
158
 class Permission(DeclarativeBase):
166
 class Permission(DeclarativeBase):
159
     """
167
     """
160
     Permission definition.
168
     Permission definition.

+ 2 - 11
pboard/pboard/model/data.py View File

55
 - data_status_id
55
 - data_status_id
56
 """
56
 """
57
 
57
 
58
+
58
 class PBNodeStatusItem(object):
59
 class PBNodeStatusItem(object):
59
   def __init__(self, psStatusId, psStatusLabel, psStatusFamily, psIconId, psCssClass): #, psBackgroundColor):
60
   def __init__(self, psStatusId, psStatusLabel, psStatusFamily, psIconId, psCssClass): #, psBackgroundColor):
60
     self._sStatusId     = psStatusId
61
     self._sStatusId     = psStatusId
222
   data_file_mime_type = Column(Unicode(255),  unique=False, nullable=False, default='')
223
   data_file_mime_type = Column(Unicode(255),  unique=False, nullable=False, default='')
223
   data_file_content   = sqlao.deferred(Column(LargeBinary(), unique=False, nullable=False, default=None))
224
   data_file_content   = sqlao.deferred(Column(LargeBinary(), unique=False, nullable=False, default=None))
224
 
225
 
226
+  rights = relation('Rights')
225
 
227
 
226
   _oParent = relationship('PBNode', remote_side=[node_id], backref='_lAllChildren')
228
   _oParent = relationship('PBNode', remote_side=[node_id], backref='_lAllChildren')
227
-  rights = relation('Rights', secondary=group_node_table, backref='nodes')
228
   _oOwner = relationship('User', remote_side=[pma.User.user_id], backref='_lAllNodes')
229
   _oOwner = relationship('User', remote_side=[pma.User.user_id], backref='_lAllNodes')
229
 
230
 
230
   def getChildrenOfType(self, plNodeTypeList, poKeySortingMethod=None, pbDoReverseSorting=False):
231
   def getChildrenOfType(self, plNodeTypeList, poKeySortingMethod=None, pbDoReverseSorting=False):
421
     # FIXME - D.A. - 2013-09-12
422
     # FIXME - D.A. - 2013-09-12
422
     # Does not match @@ at end of content.
423
     # Does not match @@ at end of content.
423
 
424
 
424
-
425
-
426
-# This is the association table for the many-to-many relationship between groups and nodes
427
-group_node_table = Table('pod_group_node', metadata,
428
-        Column('group_id', Integer, ForeignKey('pod_group.group_id',
429
-            onupdate="CASCADE", ondelete="CASCADE"), primary_key=True),
430
-        Column('node_id', Integer, ForeignKey('pod_nodes.node_id',
431
-            onupdate="CASCADE", ondelete="CASCADE"), primary_key=True),
432
-        Column('rights', Integer)
433
-)