forked from NYANDEV/forgejo
#1146 finish new access rights for collaborators
This commit is contained in:
parent
045f14fbd0
commit
a5b0400be7
22 changed files with 210 additions and 190 deletions
|
@ -348,19 +348,15 @@ func (u *User) UploadAvatar(data []byte) error {
|
|||
|
||||
// IsAdminOfRepo returns true if user has admin or higher access of repository.
|
||||
func (u *User) IsAdminOfRepo(repo *Repository) bool {
|
||||
if repo.MustOwner().IsOrganization() {
|
||||
has, err := HasAccess(u, repo, ACCESS_MODE_ADMIN)
|
||||
if err != nil {
|
||||
log.Error(3, "HasAccess: %v", err)
|
||||
}
|
||||
return has
|
||||
has, err := HasAccess(u, repo, ACCESS_MODE_ADMIN)
|
||||
if err != nil {
|
||||
log.Error(3, "HasAccess: %v", err)
|
||||
}
|
||||
|
||||
return repo.IsOwnedBy(u.Id)
|
||||
return has
|
||||
}
|
||||
|
||||
// CanWriteTo returns true if user has write access to given repository.
|
||||
func (u *User) CanWriteTo(repo *Repository) bool {
|
||||
// IsWriterOfRepo returns true if user has write access to given repository.
|
||||
func (u *User) IsWriterOfRepo(repo *Repository) bool {
|
||||
has, err := HasAccess(u, repo, ACCESS_MODE_WRITE)
|
||||
if err != nil {
|
||||
log.Error(3, "HasAccess: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue