1
0

Fixed rights check on lists and namespaces (#62)

This commit is contained in:
konrad
2019-03-08 21:31:37 +00:00
committed by Gitea
parent 65f428fe78
commit eb4d38b5b8
14 changed files with 118 additions and 161 deletions

View File

@ -33,16 +33,16 @@ import _ "code.vikunja.io/web" // For swaggerdocs generation
// @Failure 404 {object} code.vikunja.io/web.HTTPError "Team or namespace does not exist."
// @Failure 500 {object} models.Message "Internal error"
// @Router /namespaces/{namespaceID}/teams/{teamID} [post]
func (tl *TeamNamespace) Update() (err error) {
func (tn *TeamNamespace) Update() (err error) {
// Check if the right is valid
if err := tl.Right.isValid(); err != nil {
if err := tn.Right.isValid(); err != nil {
return err
}
_, err = x.
Where("namespace_id = ? AND team_id = ?", tl.TeamID, tl.TeamID).
Where("namespace_id = ? AND team_id = ?", tn.TeamID, tn.TeamID).
Cols("right").
Update(tl)
Update(tn)
return
}