feat!: rename right to permission (#1277)

This commit is contained in:
kolaente
2025-08-13 11:05:05 +02:00
committed by GitHub
parent 70eef88557
commit a81a3ee0e5
130 changed files with 872 additions and 752 deletions

View File

@@ -94,7 +94,7 @@ func NewLinkShareJWTAuthtoken(share *models.LinkSharing) (token string, err erro
claims["id"] = share.ID
claims["hash"] = share.Hash
claims["project_id"] = share.ProjectID
claims["right"] = share.Right
claims["permission"] = share.Permission
claims["sharedByID"] = share.SharedByID
claims["exp"] = exp
claims["isLocalUser"] = true // Link shares are always local

View File

@@ -115,14 +115,14 @@ func (bp *BackgroundProvider) setBackgroundPreparations(s *xorm.Session, c echo.
return nil, nil, echo.NewHTTPError(http.StatusBadRequest, "Invalid project ID: "+err.Error()).SetInternal(err)
}
// Check if the user has the right to change the project background
// Check if the user has the permission to change the project background
project = &models.Project{ID: projectID}
can, err := project.CanUpdate(s, auth)
if err != nil {
return
}
if !can {
log.Infof("Tried to update project background of project %d while not having the rights for it (User: %v)", projectID, auth)
log.Infof("Tried to update project background of project %d while not having the permissions for it (User: %v)", projectID, auth)
return project, auth, models.ErrGenericForbidden{}
}
// Load the project
@@ -309,7 +309,7 @@ func checkProjectBackgroundRights(s *xorm.Session, c echo.Context) (project *mod
return nil, auth, echo.NewHTTPError(http.StatusBadRequest, "Invalid project ID: "+err.Error()).SetInternal(err)
}
// Check if a background for this project exists + Rights
// Check if a background for this project exists + Permissions
project = &models.Project{ID: projectID}
can, _, err := project.CanRead(s, auth)
if err != nil {
@@ -318,7 +318,7 @@ func checkProjectBackgroundRights(s *xorm.Session, c echo.Context) (project *mod
}
if !can {
_ = s.Rollback()
log.Infof("Tried to get project background of project %d while not having the rights for it (User: %v)", projectID, auth)
log.Infof("Tried to get project background of project %d while not having the permissions for it (User: %v)", projectID, auth)
return nil, auth, echo.NewHTTPError(http.StatusForbidden)
}