mirror of https://github.com/mindoc-org/mindoc.git
修复私有项目无法编辑的BUG
parent
e31561fc7e
commit
3e2d6bdd36
|
@ -51,7 +51,7 @@ func isReadable (identify,token string,c *DocumentController) *models.BookResult
|
|||
} else if token, ok := c.GetSession(identify).(string); !ok || !strings.EqualFold(token, book.PrivateToken) {
|
||||
c.Abort("403")
|
||||
}
|
||||
} else {
|
||||
} else if !is_ok {
|
||||
c.Abort("403")
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ func NewBook() *Book {
|
|||
|
||||
func (m *Book) Insert() error {
|
||||
o := orm.NewOrm()
|
||||
o.Begin()
|
||||
// o.Begin()
|
||||
|
||||
_,err := o.Insert(m)
|
||||
|
||||
|
@ -76,7 +76,7 @@ func (m *Book) Insert() error {
|
|||
err = relationship.Insert()
|
||||
if err != nil {
|
||||
logs.Error("插入项目与用户关联 => ",err)
|
||||
o.Rollback()
|
||||
//o.Rollback()
|
||||
return err
|
||||
}
|
||||
document := NewDocument()
|
||||
|
@ -85,13 +85,13 @@ func (m *Book) Insert() error {
|
|||
document.MemberId = m.MemberId
|
||||
err = document.InsertOrUpdate()
|
||||
if err != nil{
|
||||
o.Rollback()
|
||||
//o.Rollback()
|
||||
return err
|
||||
}
|
||||
o.Commit()
|
||||
//o.Commit()
|
||||
return nil
|
||||
}
|
||||
o.Rollback()
|
||||
//o.Rollback()
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue