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

Method IsPermission

controllers/BookController.go:918–937  ·  view source on GitHub ↗

判断是否具有管理员或管理员以上权限

()

Source from the content-addressed store, hash-verified

916
917// 判断是否具有管理员或管理员以上权限
918func (this *BookController) IsPermission() (*models.BookResult, error) {
919
920 identify := this.GetString("identify")
921
922 book, err := models.NewBookResult().FindByIdentify(identify, this.Member.MemberId)
923 if err != nil {
924 if err == models.ErrPermissionDenied {
925 return book, errors.New("权限不足")
926 }
927 if err == orm.ErrNoRows {
928 return book, errors.New("书籍不存在")
929 }
930 return book, err
931 }
932
933 if book.RoleId != conf.BookAdmin && book.RoleId != conf.BookFounder {
934 return book, errors.New("权限不足")
935 }
936 return book, nil
937}
938
939// 从github等拉取下载markdown书籍
940func (this *BookController) DownloadProject() {

Callers 7

SaveBookMethod · 0.95
PrivatelyOwnedMethod · 0.95
TransferMethod · 0.95
UploadCoverMethod · 0.95
CreateTokenMethod · 0.95
DeleteMethod · 0.95
DownloadProjectMethod · 0.95

Calls 2

NewBookResultFunction · 0.92
FindByIdentifyMethod · 0.45

Tested by

no test coverage detected