Allow Edit for admin in circle
This commit is contained in:
parent
bafc519150
commit
3919429f77
4 changed files with 16 additions and 5 deletions
|
@ -3,6 +3,7 @@ package model
|
|||
import (
|
||||
"time"
|
||||
|
||||
cModel "donetick.com/core/internal/circle/model"
|
||||
lModel "donetick.com/core/internal/label/model"
|
||||
tModel "donetick.com/core/internal/thing/model"
|
||||
thingModel "donetick.com/core/internal/thing/model"
|
||||
|
@ -169,3 +170,15 @@ type ChoreReq struct {
|
|||
CompletionWindow *int `json:"completionWindow"`
|
||||
Description *string `json:"description"`
|
||||
}
|
||||
|
||||
func (c *Chore) CanEdit(userID int, circleUsers []*cModel.UserCircleDetail) bool {
|
||||
if c.CreatedBy == userID {
|
||||
return true
|
||||
}
|
||||
for _, cu := range circleUsers {
|
||||
if cu.UserID == userID && cu.Role == "admin" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue