Skip to content

[$50] Plugin not colouring admin handles in orange #24

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

Closed
jmgasper opened this issue Sep 1, 2020 · 11 comments
Closed

[$50] Plugin not colouring admin handles in orange #24

jmgasper opened this issue Sep 1, 2020 · 11 comments

Comments

@jmgasper
Copy link
Collaborator

jmgasper commented Sep 1, 2020

To get the role for a user:

curl --location --request GET 'http://api.topcoder-dev.com/v3/roles?filter=subjectID%3D23194912' --header 'Authorization: Bearer <token value>'

where 23194912 is the ID for nick.castillo.

The response should contain the roles for a user and we want to show orange for:

  • Admin
  • admin
  • administrator
  • Administrator
@jmgasper jmgasper self-assigned this Sep 1, 2020
@jmgasper jmgasper changed the title Plugin not colouring admin handles in orange [$30] Plugin not colouring admin handles in orange Sep 2, 2020
@jmgasper jmgasper removed their assignment Sep 2, 2020
@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 2, 2020

Contest https://www.topcoder.com/challenges/30140229 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 2, 2020

Contest https://www.topcoder.com/challenges/30140229 has been updated - it has been assigned to obog.

This is an automated message for ghostar via Topcoder X

@atelomycterus
Copy link
Collaborator

atelomycterus commented Sep 2, 2020

@jmgasper Implemented but need to test with m2m Topcoder params. I've tried to use m2m Topcoder values from challenge forum processor but I get the "The machine user should have the scope as 'read:roles'" error:
{ "id":"2e2754a9:17434e56c51:78ff", "result": {"success":true,"status":403,"metadata":null,"content":"The machine user should have the scope as 'read:roles'" }

Member API (/user/stats) used in Topcoder plugin doesn't require any auth headers.

Please provide m2m params, I'll test it.

PRs

topcoder-platform/forums-plugins#17 - Forums issues 24, issue 25
#26 - for issues-24: Added M2M params and topcoder them

New M2M TOKEN params

Need to set env vars to generate M2M token in vanilla.env.
TOPCODER_AUTH0_AUDIENCE=
TOPCODER_AUTH0_CLIENT_ID=
TOPCODER_AUTH0_CLIENT_SECRET=
TOPCODER_AUTH0_PROXY_SERVER_URL=
TOPCODER_AUTH0_URL=

Testing with hard-coded token:
image

Topcoder Plugin settings

Added the roles API param:

image

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 2, 2020

@atelomycterus - Thanks. I've requested an M2M key / secret specific to the forums.

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 3, 2020

@atelomycterus - Here are some details and feedback from Topcoder:

  1. Can we remove the TOPCODER_ prefix? Just have things like:
"AUTH0_AUDIENCE": "https://m2m.topcoder-dev.com/",
"AUTH0_URL": "https://topcoder-dev.auth0.com/oauth/token",
"AUTH0_PROXY_SERVER_URL": "https://auth0proxy.topcoder-dev.com/token",

Those above are already injected in the CI/CD build

  1. I'll email the key/secret we can use for testing

@jmgasper jmgasper changed the title [$30] Plugin not colouring admin handles in orange [$50] Plugin not colouring admin handles in orange Sep 3, 2020
@atelomycterus
Copy link
Collaborator

@jmgasper 1. Yes, sure. I'll fix it.

  1. Got the same error 'The machine user should have the scope as 'read:roles'':
    image

Get a new token:

curl --header "Content-Type: application/json" \
  --request POST \
  --data '{ "grant_type": "client_credentials","client_id": "<CLIENT_ID>","client_secret": "<CLIENT_SECRET>","audience": "https://m2m.topcoder-dev.com/", "auth0_url": "https://topcoder-dev.auth0.com/oauth/token"}' \
  https://auth0proxy.topcoder-dev.com/token

Get roles:

curl --location --request GET 'https://api.topcoder-dev.com/v3/roles?filter=subjectID%3D8547899' --header 'Authorization: Bearer <TOKEN>'

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 3, 2020

@atelomycterus - Should be fixed now, sorry about that.

@atelomycterus
Copy link
Collaborator

@jmgasper Still not working.

{"id":"2e2754a9:1744fe78e74:-36c9","result":{"success":true,"status":403,"metadata":null,"content":"The machine user should have the scope as 'read:roles'"},"version":"v3"}

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 4, 2020

@atelomycterus - Sorry about that, checking with Topcoder

@atelomycterus
Copy link
Collaborator

atelomycterus commented Sep 4, 2020

@jmgasper I see it's working now. Please apply PR - topcoder-platform/forums-plugins#18 with updated m2m token names. Thanks!

M2M token params

AUTH0_AUDIENCE=
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_PROXY_SERVER_URL=
AUTH0_URL=

Colors

The orange color is brighter for admins:

image

image

@jmgasper
Copy link
Collaborator Author

jmgasper commented Sep 6, 2020

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30140229

This is an automated message for ghostar via Topcoder X

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

2 participants