Enforce scope properly for attachment and other tables #5730
Replies: 4 comments
-
|
Can confirm it's a giant mess. Findings: All of the below scoping is enforced in sp6 only using some custom logic for every case. None of this is implemented in sp7 (unless mentioned otherwise):
Impact: Proposed ideal solutions for scoping:SimpleIf need to support dynamic scoping (scoping to different levels for different relationships), do what SpAppResourceDir table does and have optional relationships to If table is always scoped to the same level, then just have a required relationship to AdvancedHave a Then, imagine an advanced use case: when running a query, and for example want to scope results to two queries (e.x, because user said they don't want scoring, but they only have access to two collections), you just get ID of all the records in the This solution can be easily extended in the future ot add more scoping by just adding new relationship to the What is more, the |
Beta Was this translation helpful? Give feedback.
-
|
Update: Only direct relationships to scoping table are currently enforced in forms and query builder (i.e, Accession: 'division'). Back-end query builder also looks at collectionMemberId field. Front-end does not. All other non-relationship scoping fields are ignored by both front-end and back-end. |
Beta Was this translation helpful? Give feedback.
-
|
Okay, it get's worse. Turns out collection object has both collection relationship and collection id field query builder bakc-end to look at collection relationship first (in this case, can't guarantee all) front-end happens to look at collection id field (in this case, can't guarantee all) |
Beta Was this translation helpful? Give feedback.
-
There are 32 tables which have 'CollectionMemberID' column. Preferably, we would be consistent in the way we manage scoping like this, but it will have to wait until we break compatibility with Specify 6. For reference, the 32 tables are: SELECT DISTINCT table_name FROM information_schema.columns WHERE table_schema="specify" AND column_name="collectionmemberid";+----------------------------+ |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
https://github.com/specify/specify6/blame/8c853f91b76ff7633c8318aff5008e1822ca10a0/src/edu/ku/brc/specify/datamodel/Attachment.java
This is a mess,
collectionmemberidinteger fields are not the way to goBeta Was this translation helpful? Give feedback.
All reactions