Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

refactor: Return DisplayName and Name in the roles endpoint#1328

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
BrunoQuaresma merged 2 commits intomainfrombq/return-role-display-name
May 6, 2022

Conversation

BrunoQuaresma
Copy link
Collaborator

No description provided.

@BrunoQuaresmaBrunoQuaresma requested review fromEmyrk anda teamMay 6, 2022 18:10
@BrunoQuaresmaBrunoQuaresma self-assigned thisMay 6, 2022
@codecov
Copy link

codecovbot commentedMay 6, 2022
edited
Loading

Codecov Report

Merging#1328 (85d6f69) intomain (57bb108) willincrease coverage by8.47%.
The diff coverage is100.00%.

@@            Coverage Diff             @@##             main    #1328      +/-   ##==========================================+ Coverage   58.09%   66.56%   +8.47%==========================================  Files         282      280       -2       Lines       18521    18383     -138       Branches      231      235       +4     ==========================================+ Hits        10759    12237    +1478+ Misses       6601     4902    -1699- Partials     1161     1244      +83
FlagCoverage Δ
unittest-go-macos-latest53.75% <100.00%> (+0.07%)⬆️
unittest-go-postgres-65.15% <100.00%> (?)
unittest-go-ubuntu-latest56.18% <100.00%> (+0.12%)⬆️
unittest-go-windows-2022?
unittest-js73.67% <ø> (+0.52%)⬆️
Impacted FilesCoverage Δ
coderd/rbac/builtin.go92.70% <100.00%> (+0.27%)⬆️
coderd/roles.go100.00% <100.00%> (ø)
coderd/users.go61.36% <100.00%> (ø)
codersdk/roles.go80.64% <100.00%> (+7.91%)⬆️
cli/configssh.go62.04% <0.00%> (-6.57%)⬇️
codersdk/provisionerdaemons.go61.97% <0.00%> (-5.64%)⬇️
pty/ptytest/ptytest.go86.95% <0.00%> (-4.35%)⬇️
site/src/xServices/users/usersXService.ts75.00% <0.00%> (-4.17%)⬇️
cli/templateinit.go58.62% <0.00%> (-3.45%)⬇️
site/src/pages/UsersPage/UsersPage.tsx75.86% <0.00%> (-3.31%)⬇️
... and29 more

Continue to review full report at Codecov.

Legend -Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing data
Powered byCodecov. Last update57bb108...85d6f69. Read thecomment docs.

@BrunoQuaresma
Copy link
CollaboratorAuthor

BrunoQuaresma commentedMay 6, 2022
edited
Loading

Closes#1329

return roles, json.NewDecoder(res.Body).Decode(&roles)
}

func RolesFromName(roleNames []string) []Role {
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Created this function to use in the endpoints to not break any internal implementation.

return roles, json.NewDecoder(res.Body).Decode(&roles)
}

func RolesFromName(roleNames []string) []Role {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Instead of having this function thatmay convert a role name to a role, you should just have a function in the rbac package that returns all site role objects.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Interesting. How would you call that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

What I'm trying to say is we should avoid having to first get the "role names" and then convert those to "roles" in a potentially lossy fashion. We should just have a function that returns the roles instead of a function that returns the role names in the rbac package.

BrunoQuaresma reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Got it. I made the update, please let me know what you think about the changes. Merging it for now.

@BrunoQuaresmaBrunoQuaresmaenabled auto-merge (squash)May 6, 2022 19:17
@BrunoQuaresmaBrunoQuaresma merged commit0080658 intomainMay 6, 2022
@BrunoQuaresmaBrunoQuaresma deleted the bq/return-role-display-name branchMay 6, 2022 19:18
@missknissmisskniss added this to theV2 Beta milestoneMay 15, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@deansheatherdeansheatherdeansheather approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

Assignees

@BrunoQuaresmaBrunoQuaresma

Labels
None yet
Projects
None yet
Milestone
V2 Beta
Development

Successfully merging this pull request may close these issues.

3 participants
@BrunoQuaresma@deansheather@misskniss

[8]ページ先頭

©2009-2025 Movatter.jp