1
0
Fork 0
forked from forgejo/forgejo

Move accessmode into models/perm (#17828)

This commit is contained in:
Lunny Xiao 2021-11-28 19:58:28 +08:00 committed by GitHub
parent 24a8d54bfb
commit 1fee11d69a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 359 additions and 295 deletions

View file

@ -8,6 +8,7 @@ package models
import (
"fmt"
"code.gitea.io/gitea/models/perm"
"code.gitea.io/gitea/modules/git"
)
@ -498,7 +499,7 @@ func (err ErrLFSLockNotExist) Error() string {
type ErrLFSUnauthorizedAction struct {
RepoID int64
UserName string
Mode AccessMode
Mode perm.AccessMode
}
// IsErrLFSUnauthorizedAction checks if an error is a ErrLFSUnauthorizedAction.
@ -508,7 +509,7 @@ func IsErrLFSUnauthorizedAction(err error) bool {
}
func (err ErrLFSUnauthorizedAction) Error() string {
if err.Mode == AccessModeWrite {
if err.Mode == perm.AccessModeWrite {
return fmt.Sprintf("User %s doesn't have write access for lfs lock [rid: %d]", err.UserName, err.RepoID)
}
return fmt.Sprintf("User %s doesn't have read access for lfs lock [rid: %d]", err.UserName, err.RepoID)