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

Status Code 400 on Linking New Team Member to Project #1335

Open
viiwee opened this issue Jul 11, 2023 · 16 comments
Open

Status Code 400 on Linking New Team Member to Project #1335

viiwee opened this issue Jul 11, 2023 · 16 comments

Comments

@viiwee
Copy link

viiwee commented Jul 11, 2023

I'm on v2.8.91. When trying to link a team member to a project, I receive an error "Request failed with status code 400". I was previously on v2.8.51, but upgraded today.

image.

No logs are generated by the Semaphore process.
My temporary fix was to modify the database directly and link the user to the project. But I think there may be an issue with the API on this button click.

Other info:

  • Using MySQL DB
  • Recently attempted to configure LDAP, reverted to check if that was the issue
@viiwee
Copy link
Author

viiwee commented Jul 11, 2023

After reverting to v2.8.90, the error went away. I had to roll back the DB structure first to remove the new role column, but that seemed to work for now.

ALTER TABLE project__user ADD `admin` BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE project__user DROP `role`;
UPDATE project__user SET admin = true WHERE user_id = 2;

@rsandj
Copy link

rsandj commented Jul 18, 2023

I see the same also on v2.8.91. I have not configured any LDAP og email. I added a user, but when trying to add the user to a team in a project, I get the same "Request failes with status code 400" as shown in the screenshot above. I have done a first time install of Semaphore.

@Arkhenys
Copy link

Arkhenys commented Jul 19, 2023

This is because roles have been added. You can view it using the API. Try a get on project's users. You will still see
"admin": true (or false)
but
"role": "owner" (or "task_runner") has also been added.

You can still link a user to a project using the API and using the "role" key with the desired value.
But it appears that from the GUI, the request is not implemented with the requested "role" key.

@makorolkov
Copy link

Bypassed this problem this way
INSERT INTO project__user(project_id,user_id,role)
VALUES(1,2,'owner');
Where user_id user we add to teams

@ansibleguy
Copy link
Contributor

ansibleguy commented Jul 19, 2023

Just linking: Issue seems to be related to #1322

@fiftin fiftin added the bug label Jul 22, 2023
@fiftin
Copy link
Collaborator

fiftin commented Jul 22, 2023

Hi all,
thank you! Will fix soon.

@fiftin
Copy link
Collaborator

fiftin commented Jul 22, 2023

hi @viiwee ,

Did you fix the issue?
Do you have access to database?

It is my mistake to make task_runner default role for non-admin users :) It should be manager.

@fiftin
Copy link
Collaborator

fiftin commented Jul 22, 2023

The issue can be easily fixed by updating roles in database:

update project__user set role = 'manager' where role = 'task_runner';

@viiwee
Copy link
Author

viiwee commented Jul 22, 2023

hi @viiwee ,

Did you fix the issue? Do you have access to database?

It is my mistake to make task_runner default role for non-admin users :) It should be manager.

I didn't test the fix on v2.8.91, I reverted back to v2.8.90 instead. It looks like your fix should work though.

Thanks for the updates!

@viiwee viiwee closed this as completed Jul 22, 2023
@viiwee viiwee reopened this Jul 22, 2023
@viiwee
Copy link
Author

viiwee commented Jul 22, 2023

Oops, did not mean to close the issue.

@kbzowski
Copy link

Is 2.8.92 safe to upgrade?

@steadfasterX
Copy link
Contributor

steadfasterX commented Jul 27, 2023

I still have that issue on a fresh v2.8.92 installation @fiftin . also using LDAP if that matters but I changed back to local and the issue remains.

that previous mentioned wrong role seems to be solved though :

MariaDB [semaphore]> select * from project__user;

+------------+---------+-------+
| project_id | user_id | role  |
+------------+---------+-------+
|          1 |       2 | owner |
|          2 |       4 | owner |
+------------+---------+-------+

the previous mentioned cmd

INSERT INTO project__user(project_id,user_id,role) VALUES(1,3,'owner');

works fine as a workaround though.

also:

  • deleting a user from the teams page
  • changing the role from the teams page

is both working fine!

PS: there is a typo in the manager role:
image

@changchichung
Copy link

I have the exact same issue, but I'm not using psql/mysql. Below is my docker-compose.yml. How should I address this problem?

services:
  semaphore:
    ports:
      - 806:3000
    image: semaphoreui/semaphore:latest
    environment:
      SEMAPHORE_DB_DIALECT: bolt
      SEMAPHORE_ADMIN_PASSWORD: adminpassword
      SEMAPHORE_ADMIN_NAME: admin
      SEMAPHORE_ADMIN_EMAIL: sa@abc.com
      SEMAPHORE_ADMIN: admin
    volumes:
      - ./semaphore:/etc/semaphore # config.json location
      - ./db:/var/lib/semaphore # database.boltdb location (Not required if using mysql or postgres)
      - ./resolv.conf:/etc/resolv.conf

@nobilisgkill4
Copy link

Same here.

Running a docker compose with postgres:14 and semaphoreui/semaphore:latest

@gaeldb
Copy link

gaeldb commented Aug 24, 2023

Hi all,

I'm on 2.8.91 and experiment the same problem.

Just need to update the POST request with a role paramater and new team member get added:

{"user_id":4,"project_id":1,"role":"manager"}

I can provide a PR. In my comprehension, this is needed:

  • API should consider a default role if no role provided. Which?
  • Request should use role to select role, instead of admin

@gaeldb
Copy link

gaeldb commented Sep 5, 2023

Fixed with 2.9.4
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests