mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 06:43:34 +01:00
Store read access in access for team repo's (#20275)
- Currently when a Team has read access to a organization's non-private repository, their access won't be stored in the database. This caused issue for code that rely on read access being stored. So from now-on if we see that the repository is owned by a organization don't increase the minMode to write permission. - Resolves #20083
This commit is contained in:
parent
cb6c5f8193
commit
8a7d1a3516
1 changed files with 7 additions and 1 deletions
|
@ -86,7 +86,13 @@ func updateUserAccess(accessMap map[int64]*userAccess, user *user_model.User, mo
|
||||||
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
|
// FIXME: do cross-comparison so reduce deletions and additions to the minimum?
|
||||||
func refreshAccesses(ctx context.Context, repo *repo_model.Repository, accessMap map[int64]*userAccess) (err error) {
|
func refreshAccesses(ctx context.Context, repo *repo_model.Repository, accessMap map[int64]*userAccess) (err error) {
|
||||||
minMode := perm.AccessModeRead
|
minMode := perm.AccessModeRead
|
||||||
if !repo.IsPrivate {
|
if err := repo.GetOwner(ctx); err != nil {
|
||||||
|
return fmt.Errorf("GetOwner: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the repo isn't private and isn't owned by a organization,
|
||||||
|
// increase the minMode to Write.
|
||||||
|
if !repo.IsPrivate && !repo.Owner.IsOrganization() {
|
||||||
minMode = perm.AccessModeWrite
|
minMode = perm.AccessModeWrite
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue