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

feat: implement custom site-wide roles in the database#13289

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

Closed
Emyrk wants to merge26 commits intomainfromstevenmasley/custom_site_roles

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedMay 16, 2024
edited
Loading

What this does

Adds the ability to create custom roles at the site level. Intentionally not doing org scoped roles yet, as org roles cannot be seen on the UI yet.

This includes the api endpoint to create a custom role. Ideally that would be another PR, but I wanted to actually test the custom roles through the api actor logic. Roles and the actor are so intertwined, if the custom roles do not work to actually grant perms at the api layer, then the feature is moot.

Future work

  • Cli interface
  • UI interface
  • Org roles (not for awhile)
  • Fetch roles api needs to include permissions
  • Delete roles

@EmyrkEmyrk marked this pull request as draftMay 16, 2024 00:22
@EmyrkEmyrk changed the titlefeat: custom site-wide roles stored in the databasefeat: implement custom site-wide roles in the databaseMay 16, 2024
@EmyrkEmyrkforce-pushed thestevenmasley/custom_site_roles branch fromb457981 toea9b9beCompareMay 16, 2024 02:45
@EmyrkEmyrkforce-pushed thestevenmasley/custom_site_roles branch from21f2cee to0d91366CompareMay 16, 2024 03:10
@EmyrkEmyrk marked this pull request as ready for reviewMay 16, 2024 03:15
@EmyrkEmyrk requested a review fromjohnstcnMay 16, 2024 04:00
Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

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

This PR is a bit too large for me to review comforably.
Can you split it up a bit?
Here's my suggestion, but feel free to modify:

  • Introduce new DB types / queries etc.
  • Add required dbauthz changes
  • Plumb in new HTTP middleware etc.

Emyrk reacted with thumbs up emoji
Comment on lines 31 to 53
funcList[Fany,Tany](list []F,convertfunc(F)T) []T {
into:=make([]T,0,len(list))
for_,item:=rangelist {
into=append(into,convert(item))
returnListLazy(convert)(list)
}

// ListLazy returns the converter function for a list, but does not eval
// the input. Helpful for combining the Map and the List functions.
funcListLazy[Fany,Tany](convertfunc(F)T)func(list []F) []T {
returnfunc(list []F) []T {
into:=make([]T,0,len(list))
for_,item:=rangelist {
into=append(into,convert(item))
}
returninto
}
}

funcMap[Kcomparable,Fany,Tany](paramsmap[K]F,convertfunc(F)T)map[K]T {
into:=make(map[K]T)
fork,item:=rangeparams {
into[k]=convert(item)
}
returninto
}
Copy link
Member

Choose a reason for hiding this comment

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

All of these should probably be incoderd/util

Comment on lines -12 to 20

typeRolestruct {
typeSlimRolestruct {
Namestring`json:"name"`
DisplayNamestring`json:"display_name"`
}

typeAssignableRolesstruct {
Role
SlimRole
Assignablebool`json:"assignable"`
}
Copy link
Member

Choose a reason for hiding this comment

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

Can you provide a comment explaining the difference betweenRole andSlimRole?

Copy link
Member

Choose a reason for hiding this comment

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

I'd like to see more tests:

  • What happens if we have existing custom roles and our license expires?
  • What happens if we patch a role and leave out certain fields in the request? Do the unspecified values get overwritten in the DB?

@Emyrk
Copy link
MemberAuthor

Split into a stack:#13298

@EmyrkEmyrk closed thisMay 16, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 16, 2024
@github-actionsgithub-actionsbot deleted the stevenmasley/custom_site_roles branchNovember 17, 2024 00:06
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@johnstcnjohnstcnjohnstcn left review comments

Assignees

@EmyrkEmyrk

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Emyrk@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp