Clarify permission "HasAccess" behavior (#30585)
Follow #30495 "HasAccess" behavior wasn't clear, to make it clear: * Use a new name `HasAnyUnitAccess`, it will be easier to review related code and permission problems. * Separate everyone access mode to a separate field, then all calls to HasAccess are reverted to old behavior before #30495. * Add new tests. --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
parent
89e39872ff
commit
48d4580dd5
13 changed files with 96 additions and 41 deletions
|
@ -82,7 +82,7 @@ func ListPackages(ctx *context.Context) {
|
|||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return
|
||||
}
|
||||
repositoryAccessMap[pd.Repository.ID] = permission.HasAccess()
|
||||
repositoryAccessMap[pd.Repository.ID] = permission.HasAnyUnitAccess()
|
||||
}
|
||||
|
||||
hasPackages, err := packages_model.HasOwnerPackages(ctx, ctx.ContextUser.ID)
|
||||
|
@ -276,7 +276,7 @@ func ViewPackageVersion(ctx *context.Context) {
|
|||
ctx.ServerError("GetUserRepoPermission", err)
|
||||
return
|
||||
}
|
||||
hasRepositoryAccess = permission.HasAccess()
|
||||
hasRepositoryAccess = permission.HasAnyUnitAccess()
|
||||
}
|
||||
ctx.Data["HasRepositoryAccess"] = hasRepositoryAccess
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue