Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Allow user who created Job to edit it #112

Closed
maxceem opened this issue Feb 23, 2021 · 9 comments
Closed

Allow user who created Job to edit it #112

maxceem opened this issue Feb 23, 2021 · 9 comments
Assignees
Labels
Milestone

Comments

@maxceem
Copy link
Contributor

maxceem commented Feb 23, 2021

As a part of this issue #12 we have to allow editing jobs for users who have permissions for that.

image

At the moment we are only allowing editing jobs to the BookingManagers and Administrators, but we don't allow edit jobs to customer users who create such jobs.

The reason for this, because TaaS API uses V5 user ids to for createdBy and updatedBy fields:

{ // example job object
  title: "Job title",
  createdBy: "57646ff9-1cd3-4d3c-88ba-eb09a395366c", // <----- V5 User ID
  updatedBy: "077fd578-7463-457f-b6ef-22c02178d7f5"
  // other fields
}

But we don't know the V5 user id of the logged in user, we only know V3 userId and handle:

{
   userId: 40159127 // <----- V5 User ID
   handle: "pshah_manager"
}   

So we have to know somehow V5 User id of the logged-in user client-side. I'm not sure if we have such an endpoint that could be called by any user to obtain it.

FYI @nkumar-topcoder

@sandhiyakavi
Copy link
Collaborator

According to my observation, eventhough the creator of the job don't have Edit Job details button, he still be able to edit the job by accessing the Edit job page url.

@nkumar-topcoder
Copy link
Contributor

nkumar-topcoder commented May 14, 2021

@maxceem
Pls let me know if below approach helps.

  1. get createdby userid from jobs api.
  2. pass the UUID to v5/users. This will fetch userhandle.
    http://api.topcoder-dev.com/v5/users/f8eca99a-xxxxxxxxxxxxxxx
  3. via userhandle we can call v3/users or v5/users and get related user info

And go-ahead for enhancement if it's fine.

additional info

https://api.topcoder-dev.com/v3/users?filter=handle=<userhandle>
https://api.topcoder-dev.com/v3/members/<userhandle>

http://api.topcoder-dev.com/v5/users?handle=<userhandle>

@maxceem
Copy link
Contributor Author

maxceem commented May 14, 2021

@nkumar-topcoder we've created endpoint /taas-teams/me which returns the V5 user profile for the current user which we can use to implement this feature.

Sum up:

@maxceem
Copy link
Contributor Author

maxceem commented May 14, 2021

@yoution would you like to handle it as a private task as per the comment above #112 (comment)?

Payment $50.

@yoution
Copy link
Contributor

yoution commented May 14, 2021

@maxceem please assign to me

@maxceem
Copy link
Contributor Author

maxceem commented May 15, 2021

@yoution assigned

Branch to work: master. Create PR.

yoution added a commit to yoution/taas-app that referenced this issue May 15, 2021
yoution added a commit to yoution/taas-app that referenced this issue May 17, 2021
yoution added a commit to yoution/taas-app that referenced this issue May 18, 2021
maxceem added a commit that referenced this issue May 18, 2021
@maxceem
Copy link
Contributor Author

maxceem commented May 18, 2021

@sandhiyakavi @SathyaJayabal this is fixed and ready for testing in DEV.

@sandhiyakavi
Copy link
Collaborator

Verified below cases in Dev. Working as expected.

  1. Edit Job details button available and able to edit if member created Job from Taas app /Connect.
  2. The permission level for the Booking Manager and Topcoder manager is correct.
bandicam.2021-05-19.12-42-35-807.mp4

@sandhiyakavi
Copy link
Collaborator

Verified in Prod.

Edit Job details button available and able to edit if member created Job from Taas app /Connect.

bandicam.2021-05-25.15-00-31-050.mp4

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

No branches or pull requests

4 participants