From 93fb029893497ce07eec266293ed3ebbe9ae94c8 Mon Sep 17 00:00:00 2001 From: Minho Date: Tue, 10 Apr 2018 09:21:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E9=A1=B9=E7=9B=AE=E5=92=8C?= =?UTF-8?q?=E6=96=87=E6=A1=A3=E9=94=81=E5=AE=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/BookController.go | 1 + controllers/DocumentController.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/controllers/BookController.go b/controllers/BookController.go index 092e6e16..a11fe5e9 100644 --- a/controllers/BookController.go +++ b/controllers/BookController.go @@ -121,6 +121,7 @@ func (c *BookController) Setting() { //保存项目信息 func (c *BookController) SaveBook() { + c.Prepare() bookResult, err := c.IsPermission() if err != nil { diff --git a/controllers/DocumentController.go b/controllers/DocumentController.go index 3a911451..393bc3dc 100644 --- a/controllers/DocumentController.go +++ b/controllers/DocumentController.go @@ -1252,8 +1252,8 @@ func (c *DocumentController) Lock() { } } else { bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId) - - if err != nil || bookResult.RoleId == conf.BookObserver { + //只有创始人和管理员才能锁定文档 + if err != nil || (bookResult.RoleId != conf.BookAdmin && bookResult.RoleId != conf.BookFounder) { beego.Error("FindByIdentify => ", err) c.JsonResult(6002, "项目不存在或权限不足") } @@ -1295,8 +1295,8 @@ func (c *DocumentController) UnLock() { } } else { bookResult, err := models.NewBookResult().FindByIdentify(identify, c.Member.MemberId) - - if err != nil || bookResult.RoleId == conf.BookObserver { + //只有创始人或管理员才能解锁文档 + if err != nil || (bookResult.RoleId != conf.BookAdmin && bookResult.RoleId != conf.BookFounder) { beego.Error("FindByIdentify => ", err) c.JsonResult(6002, "项目不存在或权限不足") }