MCPcopy Index your code
hub / github.com/TruthHun/BookStack / IsPermission

Method IsPermission

controllers/BookMemberController.go:149–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

147}
148
149func (this *BookMemberController) IsPermission() (*models.BookResult, error) {
150 identify := this.GetString("identify")
151 book, err := models.NewBookResult().FindByIdentify(identify, this.Member.MemberId)
152
153 if err != nil {
154 if err == models.ErrPermissionDenied {
155 return book, errors.New("权限不足")
156 }
157 if err == orm.ErrNoRows {
158 return book, errors.New("书籍不存在")
159 }
160 return book, err
161 }
162 if book.RoleId != conf.BookAdmin && book.RoleId != conf.BookFounder {
163 return book, errors.New("权限不足")
164 }
165 return book, nil
166}

Callers 1

AddMemberMethod · 0.95

Calls 2

NewBookResultFunction · 0.92
FindByIdentifyMethod · 0.45

Tested by

no test coverage detected