mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
fixed issue when no gitlab permissions exist, but user is repo owner
This commit is contained in:
parent
eddc11130a
commit
c858c3b2b8
@ -83,13 +83,23 @@ func (r *Gitlab) GetRepos(user *model.User) ([]*model.Repo, error) {
|
||||
|
||||
// if no permissions we should skip the repository
|
||||
// entirely, since this should never happen
|
||||
if item.Permissions == nil {
|
||||
if repo.Owner != user.Login && item.Permissions == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
repo.Role.Admin = IsAdmin(item)
|
||||
repo.Role.Write = IsWrite(item)
|
||||
repo.Role.Read = IsRead(item)
|
||||
// if the user is the owner we can assume full access,
|
||||
// otherwise check for the permission items.
|
||||
if repo.Owner == user.Login {
|
||||
repo.Role = new(model.Perm)
|
||||
repo.Role.Admin = true
|
||||
repo.Role.Write = true
|
||||
repo.Role.Read = true
|
||||
} else {
|
||||
repo.Role.Admin = IsAdmin(item)
|
||||
repo.Role.Write = IsWrite(item)
|
||||
repo.Role.Read = IsRead(item)
|
||||
}
|
||||
|
||||
repos = append(repos, &repo)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user