#873 closed defect (invalid)
core__user_privileges foreign key columns are reversed
Reported by: | David Thompson | Owned by: | |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description
the coreprivileges_users table consists of two foreign key columns: coreuser_id and coreprivilege_id. However, coreuser_id contains privilege ids and coreprivilege_id contains user ids! For example, running the query "DELETE FROM coreprivileges_users WHERE coreuser_id=3;" will delete all of the uploader privileges. Bad stuff.
Here is the offending code:
class PrivilegeUserAssociation(Base):
This table holds the many-to-many relationship between User and Privilege
tablename = 'coreprivileges_users'
privilege_id = Column(
'coreprivilege_id',
Integer,
ForeignKey(User.id),
primary_key=True)
user_id = Column(
'coreuser_id',
Integer,
ForeignKey(Privilege.id),
primary_key=True)
Change History (2)
comment:1 by , 11 years ago
Keywords: | privileges sql removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
Poorly formatted. Opening a new ticket.