Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add business rule for user name uniqueness. #2260

Closed
Tracked by #2924
benanhalt opened this issue Sep 30, 2022 · 2 comments
Closed
Tracked by #2924

Add business rule for user name uniqueness. #2260

benanhalt opened this issue Sep 30, 2022 · 2 comments
Assignees
Labels
1 - Bug Incorrect behavior of the product
Milestone

Comments

@benanhalt
Copy link
Contributor

So that the following IntegrityError would have been caught as a BusinessRuleException:

specifycloud-invertebratepaleontology-1  | [30/Sep/2022 13:22:53] [ERROR] [django.request:222] Internal Server Error: /api/specify/specifyuser/
specifycloud-invertebratepaleontology-1  | Traceback (most recent call last):
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
specifycloud-invertebratepaleontology-1  |     return self.cursor.execute(sql, params)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 71, in execute
specifycloud-invertebratepaleontology-1  |     return self.cursor.execute(query, args)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/cursors.py", line 250, in execute
specifycloud-invertebratepaleontology-1  |     self.errorhandler(self, exc, value)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/connections.py", line 50, in defaulterrorhandler
specifycloud-invertebratepaleontology-1  |     raise errorvalue
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/cursors.py", line 247, in execute
specifycloud-invertebratepaleontology-1  |     res = self._query(query)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/cursors.py", line 412, in _query
specifycloud-invertebratepaleontology-1  |     rowcount = self._do_query(q)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/cursors.py", line 375, in _do_query
specifycloud-invertebratepaleontology-1  |     db.query(q)
specifycloud-invertebratepaleontology-1  |   File "/opt/specify7/ve/lib/python3.8/site-packages/MySQLdb/connections.py", line 276, in query
specifycloud-invertebratepaleontology-1  |     _mysql.connection.query(self, query)
specifycloud-invertebratepaleontology-1  | _mysql_exceptions.IntegrityError: (1062, "Duplicate entry 'amaya' for key 'Name'")
specifycloud-invertebratepaleontology-1  | 

@benanhalt benanhalt added 1 - Bug Incorrect behavior of the product pri:unknown labels Sep 30, 2022
@benanhalt benanhalt self-assigned this Sep 30, 2022
melton-jason added a commit that referenced this issue Feb 22, 2023
Fixes #2260

Adds the following Uniqueness Rules:

Of the form:
Table.field -> uniqueIn

CollectingEvent.uniqueidentifier -> discipline
CollectionObject.uniqueidentifier -> collection
DisposalAgent.role/agent -> disposal
Extractor.agent -> dnasequence
Fundingagent.agentt -> collectingtrip
Locality.uniqueidentifier -> discipline
LocalityCitation.referencework -> locality
PcrPerson.agent -> dnasequence
Specifyuser.name -> (DATABASE)
@grantfitzsimmons grantfitzsimmons moved this to 📋 Backlog in Back-End Backlog Mar 9, 2023
@melton-jason
Copy link
Contributor

This is currently fixed in #2965 (along with other missing uniqueness rules) and will be included with all of the other Business Rule refactoring changes.

melton-jason added a commit that referenced this issue Apr 10, 2023
Fixes #2260

Adds the following Uniqueness Rules:

Of the form:
Table.field -> uniqueIn

CollectingEvent.uniqueidentifier -> discipline
CollectionObject.uniqueidentifier -> collection
DisposalAgent.role/agent -> disposal
Extractor.agent -> dnasequence
Fundingagent.agentt -> collectingtrip
Locality.uniqueidentifier -> discipline
LocalityCitation.referencework -> locality
PcrPerson.agent -> dnasequence
Specifyuser.name -> (DATABASE)
@grantfitzsimmons grantfitzsimmons added this to the 7.9 milestone Aug 8, 2023
@grantfitzsimmons
Copy link
Member

Fixed in #2965

Will be included in 7.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product
Projects
Status: Done
Development

No branches or pull requests

5 participants