{"action":"created","issue":{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/187","labels_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/187/labels{/name}","comments_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/187/comments","events_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/187/events","html_url":"https://github.com/GENI-NSF/geni-ch/issues/187","id":78373356,"number":187,"title":"multiple join requests are allowed from the same member","user":{"login":"ahelsing","id":12136824,"avatar_url":"https://avatars.githubusercontent.com/u/12136824?v=3","gravatar_id":"","url":"https://api.github.com/users/ahelsing","html_url":"https://github.com/ahelsing","followers_url":"https://api.github.com/users/ahelsing/followers","following_url":"https://api.github.com/users/ahelsing/following{/other_user}","gists_url":"https://api.github.com/users/ahelsing/gists{/gist_id}","starred_url":"https://api.github.com/users/ahelsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahelsing/subscriptions","organizations_url":"https://api.github.com/users/ahelsing/orgs","repos_url":"https://api.github.com/users/ahelsing/repos","events_url":"https://api.github.com/users/ahelsing/events{/privacy}","received_events_url":"https://api.github.com/users/ahelsing/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"tcmitchell","id":340136,"avatar_url":"https://avatars.githubusercontent.com/u/340136?v=3","gravatar_id":"","url":"https://api.github.com/users/tcmitchell","html_url":"https://github.com/tcmitchell","followers_url":"https://api.github.com/users/tcmitchell/followers","following_url":"https://api.github.com/users/tcmitchell/following{/other_user}","gists_url":"https://api.github.com/users/tcmitchell/gists{/gist_id}","starred_url":"https://api.github.com/users/tcmitchell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tcmitchell/subscriptions","organizations_url":"https://api.github.com/users/tcmitchell/orgs","repos_url":"https://api.github.com/users/tcmitchell/repos","events_url":"https://api.github.com/users/tcmitchell/events{/privacy}","received_events_url":"https://api.github.com/users/tcmitchell/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/milestones/14","html_url":"https://github.com/GENI-NSF/geni-ch/milestones/1.4","labels_url":"https://api.github.com/repos/GENI-NSF/geni-ch/milestones/14/labels","id":1119892,"number":14,"title":"1.4","description":null,"creator":{"login":"ahelsing","id":12136824,"avatar_url":"https://avatars.githubusercontent.com/u/12136824?v=3","gravatar_id":"","url":"https://api.github.com/users/ahelsing","html_url":"https://github.com/ahelsing","followers_url":"https://api.github.com/users/ahelsing/followers","following_url":"https://api.github.com/users/ahelsing/following{/other_user}","gists_url":"https://api.github.com/users/ahelsing/gists{/gist_id}","starred_url":"https://api.github.com/users/ahelsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahelsing/subscriptions","organizations_url":"https://api.github.com/users/ahelsing/orgs","repos_url":"https://api.github.com/users/ahelsing/repos","events_url":"https://api.github.com/users/ahelsing/events{/privacy}","received_events_url":"https://api.github.com/users/ahelsing/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":0,"state":"open","created_at":"2015-05-20T05:06:44Z","updated_at":"2015-05-20T05:06:49Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-05-20T05:06:49Z","updated_at":"2015-05-20T05:07:00Z","closed_at":null,"body":"The same member can request to join a project multiple times, and the pending requests will all be added to the database.  It would be better to check for a pending request and reject additional ones.\n\n _Imported from trac ticket [#187](http://trac.gpolab.bbn.com/chapi/ticket/187),  created by phelinek on 12-12-2013 at 16:10, last modified: 01-27-2014 at 15:14_\n"},"comment":{"url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/comments/103760152","html_url":"https://github.com/GENI-NSF/geni-ch/issues/187#issuecomment-103760152","issue_url":"https://api.github.com/repos/GENI-NSF/geni-ch/issues/187","id":103760152,"user":{"login":"ahelsing","id":12136824,"avatar_url":"https://avatars.githubusercontent.com/u/12136824?v=3","gravatar_id":"","url":"https://api.github.com/users/ahelsing","html_url":"https://github.com/ahelsing","followers_url":"https://api.github.com/users/ahelsing/followers","following_url":"https://api.github.com/users/ahelsing/following{/other_user}","gists_url":"https://api.github.com/users/ahelsing/gists{/gist_id}","starred_url":"https://api.github.com/users/ahelsing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahelsing/subscriptions","organizations_url":"https://api.github.com/users/ahelsing/orgs","repos_url":"https://api.github.com/users/ahelsing/repos","events_url":"https://api.github.com/users/ahelsing/events{/privacy}","received_events_url":"https://api.github.com/users/ahelsing/received_events","type":"User","site_admin":false},"created_at":"2015-05-20T05:07:00Z","updated_at":"2015-05-20T05:07:00Z","body":"Rough code for a fix:\r\n```\r\n--- a/chapi/plugins/sarm/SAv1PersistentImplementation.py\r\n+++ b/chapi/plugins/sarm/SAv1PersistentImplementation.py\r\n@@ -1424,6 +1424,23 @@ class SAv1PersistentImplementation(SAv1DelegateBase):\r\n                            request_details, credentials, options, session):\r\n \r\n         client_uuid = get_uuid_from_cert(client_cert)\r\n+\r\n+        # Ticket 187: Check for an existing request with the same context_type, context_id, request_type, client_uuid\r\n+        # If there is one, then reject this request\r\n+\r\n+        q = session.query(self.db.PROJECT_REQUEST_TABLE.c.id)\r\n+        q = q.filter(self.db.PROJECT_REQUEST_TABLE.c.context_type == context_type)\r\n+        q = q.filter(self.db.PROJECT_REQUEST_TABLE.c.context_id == context_id)\r\n+        q = q.filter(self.db.PROJECT_REQUEST_TABLE.c.request_type == request_type)\r\n+        q = q.filter(self.db.PROJECT_REQUEST_TABLE.c.requestor == client_uuid)\r\n+        q = q.filter(self.db.PROJECT_REQUEST_TABLE.c.status == PENDING_STATUS)\r\n+        if q.count() > 0:\r\n+            # log an error message\r\n+            user_email = get_email_from_cert(client_cert)\r\n+            chapi_info(SA_LOG_PREFIX, \"Ignoring duplicate project join request to join %s.\" % context_id, {'user': user_email})\r\n+            # return the ID of the existing request\r\n+            return q.one().id\r\n+\r\n         ins = self.db.PROJECT_REQUEST_TABLE.insert().values(\r\n             context_type = context_type, \\\r\n```\r\n\n\n_Trac comment by ahelsing on 01-13-2014 at 15:00_\n"}}