PalisadoesFoundation / talawa-api

API Backend for the Talawa Mobile App. Click on the link below to see our documentation
https://docs.talawa.io/
GNU General Public License v3.0
217 stars 771 forks source link

Cannot register as LAST_RESORT_SUPERADMIN_EMAIL #2165

Closed palisadoes closed 1 month ago

palisadoes commented 6 months ago

Describe the bug

You cannot register using the LAST_RESORT_SUPERADMIN_EMAIL email address

To Reproduce Steps to reproduce the behavior:

  1. Use the latest API and Admin develop code
  2. Run the API setup
    1. Set the LAST_RESORT_SUPERADMIN_EMAIL
    2. Install the sample data database
  3. Start the API and Admin
  4. You cannot register using the LAST_RESORT_SUPERADMIN_EMAIL email address

Expected behavior A clear and concise description of what you expected to happen.

Actual behavior

API Logs

[0] error 2024-04-06 08:14:26 k31ed6d2cg Field "UserInput.selectedOrganization" of required type "ID!" was not provided. {"locations":[{"line":3,"column":11}],"extensions":{"code":"GRAPHQL_VALIDATION_FAILED","stacktrace":["GraphQLError: Field \"UserInput.selectedOrganization\" of required type \"ID!\" was not provided.","    at Object.ObjectValue (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js:64:13)","    at Object.enter (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/graphql/language/visitor.js:301:32)","    at Object.enter (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/graphql/utilities/TypeInfo.js:391:27)","    at visit (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/graphql/language/visitor.js:197:21)","    at validate (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/graphql/validation/validate.js:91:24)","    at processGraphQLRequest (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/@apollo/server/src/requestPipeline.ts:247:40)","    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","    at internalExecuteOperation (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/@apollo/server/src/ApolloServer.ts:1313:12)","    at runHttpQuery (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/@apollo/server/src/runHttpQuery.ts:232:27)","    at runPotentiallyBatchedHttpQuery (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/@apollo/server/src/httpBatching.ts:85:12)","    at ApolloServer.executeHTTPGraphQLRequest (/home/peter/code/GitHub/PalisadoesFoundation/talawa-api/node_modules/@apollo/server/src/ApolloServer.ts:1087:14)"]}} 
[0] info 2024-04-06 08:14:26 k31ed6d2cg ::1 - - [06/Apr/2024:15:14:26 +0000] "POST /graphql/ HTTP/1.1" 400 158 9.270 ms  

Screenshots

image

Additional details

This may be related to:

  1. https://github.com/PalisadoesFoundation/talawa-admin/issues/1440
  2. https://github.com/PalisadoesFoundation/talawa-api/pull/2143

Potential internship candidates

adi790uu commented 6 months ago

@palisadoes would like to solve this.

palisadoes commented 6 months ago

Please write a test to make sure the LAST_RESORT_SUPERADMIN_EMAIL can always register. This was supposed to have been fixed before, but now it's broken.

These are possibly related issues.

  1. https://github.com/PalisadoesFoundation/talawa-api/issues/2048
  2. https://github.com/PalisadoesFoundation/talawa-admin/issues/1768
adi790uu commented 6 months ago

Working on this.

adi790uu commented 6 months ago
  1. @palisadoes got the exact issue but need some help there is a selectedOrganization argument which the signup api mutation is using which is not being passed from the frontend I would like to know what is the exact use of this argument in this mutation.

  2. From the code it looks like it is making the user join an organization or create a membership request.

adi790uu commented 6 months ago

but a superAdmin does not require joining any organization, I have to separate the login for superAdmin

palisadoes commented 6 months ago
  1. We are now requiring people to select an organization when they register. This will help to ensure that the Mobile and User portal users can access a default newsfeed on login. This is implemented in mobile, but not yet in the User portal
  2. One of the latest Admin PRs uses a registration dropdown to implement this
    1. https://github.com/PalisadoesFoundation/talawa-admin/pull/1904
    2. One approach would be for the SuperAdmin of last resort to registers with one of the organizations as normal, then you update the DB schema to undo the relationship afterwards. Would that make sense?
adi790uu commented 6 months ago

@palisadoes Do you mean that whatever the SuperAdmin of last resort selects it doesn't matter we would register him/her as an Admin for all the organizations?

palisadoes commented 6 months ago

After some thought we should make the LAST_RESORT_SUPERADMIN_EMAIL user select an organization on registration and we add them to just that organization in adminFor, but also set isSuperAdmin.

Is this how we handle an Admin or member being promoted to SuperAdmin currently? Or do we reset adminFor, but also set isSuperAdmin?

github-actions[bot] commented 6 months ago

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

Huy1996 commented 5 months ago

@adi790uu Are you still working on this?

adi790uu commented 5 months ago

Yeah I was busy so couldn't get to this but will finish this as soon as possible.

github-actions[bot] commented 5 months ago

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

palisadoes commented 5 months ago

Unassigning. Inactivity

github-actions[bot] commented 5 months ago

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

prayanshchh commented 1 month ago

when I tried to register using the LAST_RESORT_SUPERADMIN_EMAIL email address, a toast notifcation came "wait for admin approval"

is this the issue? (refer to pic)

image

palisadoes commented 1 month ago

Closing. It looks like it's been fixed.