示例#1
0
        public async Task <IActionResult> UpdateNoteBookTitle(string token, string notebookId, string notebookTitle, string dataSignJson)
        {
            var re       = new ApiRe();
            var user     = tokenSerivce.GetUserByToken(token);
            var notebook = notebookService.GetNotebookById(notebookId.ToLongByHex());

            if (user == null || notebook == null)
            {
                return(LeanoteJson(re));
            }
            var verify = false;

            if (this.config.SecurityConfig.ForceDigitalSignature)
            {
                //验证签名
                var dataSign = DataSignDTO.FromJSON(dataSignJson);
                verify = await this.ePassService.VerifyDataSign(dataSign);

                if (!verify)
                {
                    return(LeanoteJson(re));
                }
                verify = dataSign.SignData.Operate.Equals("/api/Notebook/UpdateNoteBookTitle");
                if (!verify)
                {
                    re.Msg = "Operate is not Equals ";
                    return(LeanoteJson(re));
                }
                //签名存证
                this.dataSignService.AddDataSign(dataSign, "UpdateNoteBookTitle");
            }



            var repositoryId = notebook.NotesRepositoryId;

            verify = noteRepositoryService.Verify(repositoryId, user.UserId, RepositoryAuthorityEnum.Write);
            if (!verify)
            {
                return(LeanoteJson(re));
            }


            notebookService.UpdateNotebookTitle(notebook.NotebookId, notebookTitle);
            re.Ok   = true;
            re.Data = notebook;

            return(LeanoteJson(re));
        }
示例#2
0
        public JsonResult UpdateNotebookTitle(string notebookId, string title)
        {
            var result = notebookService.UpdateNotebookTitle(notebookId.ToLongByHex(), GetUserIdBySession(), title);

            return(Json(result, MyJsonConvert.GetSimpleOptions()));
        }