doortts doortts 2017-01-27
access-rule: Make user can see original content text
Now, users with read permission can view original text.
It is useful when someone want to see text and copy it.
@691986cac111fbc8b3dc242858b9db5f97359581
app/assets/stylesheets/less/_yobiUI.less
--- app/assets/stylesheets/less/_yobiUI.less
+++ app/assets/stylesheets/less/_yobiUI.less
@@ -1135,8 +1135,8 @@
     background:transparent;
     border:0;
     outline:none;
-    font-size:0px;
-    line-height:normal;
+    font-size:0;
+    line-height:20px;
 }
 
 .numberic {
app/controllers/BoardApp.java
--- app/controllers/BoardApp.java
+++ app/controllers/BoardApp.java
@@ -261,7 +261,7 @@
         Project project = Project.findByOwnerAndProjectName(owner, projectName);
         Posting posting = Posting.findByNumber(project, number);
 
-        if (!AccessControl.isAllowed(UserApp.currentUser(), posting.asResource(), Operation.UPDATE)) {
+        if (!AccessControl.isAllowed(UserApp.currentUser(), posting.asResource(), Operation.READ)) {
             return forbidden(ErrorViews.Forbidden.render("error.forbidden", project));
         }
 
app/controllers/IssueApp.java
--- app/controllers/IssueApp.java
+++ app/controllers/IssueApp.java
@@ -468,7 +468,7 @@
         Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
         Issue issue = Issue.findByNumber(project, number);
 
-        if (!AccessControl.isAllowed(UserApp.currentUser(), issue.asResource(), Operation.UPDATE)) {
+        if (!AccessControl.isAllowed(UserApp.currentUser(), issue.asResource(), Operation.READ)) {
             return forbidden(ErrorViews.Forbidden.render("error.forbidden", project));
         }
 
app/views/board/edit.scala.html
--- app/views/board/edit.scala.html
+++ app/views/board/edit.scala.html
@@ -86,7 +86,8 @@
               </label>
             </span>
           }
-          <button class="ybtn ybtn-info" tabindex="3">@Messages("button.save")</button><!--
+          @if(isAllowed(UserApp.currentUser(), posting.asResource(), Operation.UPDATE)) {
+          <button class="ybtn ybtn-info" tabindex="3">@Messages("button.save")</button>}<!--
          --><a href="javascript:history.back();" class="ybtn" tabindex="4">@Messages("button.cancel")</a>
         </div>
       </div>
app/views/board/partial_comments.scala.html
--- app/views/board/partial_comments.scala.html
+++ app/views/board/partial_comments.scala.html
@@ -59,7 +59,7 @@
                     <a href="#comment-@comment.id" class="ago" title="@JodaDateUtil.getDateString(comment.createdDate)">@utils.TemplateHelper.agoOrDateString(comment.createdDate)</a>
                 </span>
                 <span class="act-row pull-right">
-                    @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) {
+                    @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.READ)) {
                         <button type="button" class="btn-transparent mr10" data-toggle="comment-edit" data-comment-id="@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button>
                     }
                     @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.DELETE)) {
app/views/board/view.scala.html
--- app/views/board/view.scala.html
+++ app/views/board/view.scala.html
@@ -98,6 +98,8 @@
 
                     @if(isAllowed(UserApp.currentUser(), post.asResource(), Operation.UPDATE)) {
                         <a href="@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)" class="ybtn">@Messages("button.edit")</a>
+                    } else {
+                        <a href="@routes.BoardApp.editPostForm(project.owner, project.name, post.getNumber)" class="ybtn">@Messages("button.show.original")</a>
                     }
                 </div>
                 <div class="watcher-list"></div>
app/views/common/commentUpdateForm.scala.html
--- app/views/common/commentUpdateForm.scala.html
+++ app/views/common/commentUpdateForm.scala.html
@@ -1,24 +1,11 @@
 @**
-* Yobi, Project Hosting SW
+* Yona, 21st Century Project Hosting SW
 *
-* Copyright 2014 NAVER Corp.
-* http://yobi.io
-*
-* @author Suwon Chae
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
+* Copyright Yona & Yobi Authors & NAVER Corp.
+* https://yona.io
 **@
 @(comment:Comment, action:String, contents:String)
+@import utils.AccessControl._
 
 <div id="comment-editform-@comment.id" class="comment-update-form">
     <form action="@action" method="post">
@@ -38,7 +25,9 @@
                     </span>
                     }
                     <button type="button" class="ybtn ybtn-cancel" data-comment-id="@comment.id">@Messages("button.cancel")</button>
-                    <button type="submit" class="ybtn ybtn-info">@Messages("button.save")</button>
+                    @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) {
+                        <button type="submit" class="ybtn ybtn-info">@Messages("button.save")</button>
+                    }
                 </div>
             </div>
         </div>
app/views/issue/edit.scala.html
--- app/views/issue/edit.scala.html
+++ app/views/issue/edit.scala.html
@@ -79,7 +79,8 @@
                             </label>
                         </span>
                         }
-                        <button type="submit" class="ybtn ybtn-info">@Messages("button.save")</button><!--
+                        @if(isAllowed(UserApp.currentUser(), issue.asResource(), Operation.UPDATE)) {
+                        <button type="submit" class="ybtn ybtn-info">@Messages("button.save")</button>}<!--
                      --><a href="javascript:history.back();" class="ybtn">@Messages("button.cancel")</a>
                     </div>
                 </div>
app/views/issue/partial_comments.scala.html
--- app/views/issue/partial_comments.scala.html
+++ app/views/issue/partial_comments.scala.html
@@ -139,7 +139,7 @@
                         }
                     }
 
-                    @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.UPDATE)) {
+                    @if(isAllowed(UserApp.currentUser(), comment.asResource(), Operation.READ)) {
                         <button type="button" class="btn-transparent-with-fontsize-lineheight ml10" data-toggle="comment-edit" data-comment-id="@comment.id" title="@Messages("common.comment.edit")"><i class="yobicon-edit-2"></i></button>
                     }
 
app/views/issue/view.scala.html
--- app/views/issue/view.scala.html
+++ app/views/issue/view.scala.html
@@ -150,6 +150,8 @@
 
                     @if(isAllowed(UserApp.currentUser(), issue.asResource(), Operation.UPDATE)) {
                         <a href="@routes.IssueApp.editIssueForm(project.owner, project.name, issue.getNumber)" class="ybtn">@Messages("button.edit")</a>
+                    } else {
+                        <a href="@routes.IssueApp.editIssueForm(project.owner, project.name, issue.getNumber)" class="ybtn">@Messages("button.show.original")</a>
                     }
                 </div>
                 <div class="watcher-list"></div>
conf/messages
--- conf/messages
+++ conf/messages
@@ -67,6 +67,7 @@
 button.save = Save
 button.selectAll = Select all
 button.selectFile = Select file
+button.show.original = See text
 button.signup = Sign up for {0}
 button.submitForm = Submit form
 button.upload = File upload
conf/messages.ko-KR
--- conf/messages.ko-KR
+++ conf/messages.ko-KR
@@ -67,6 +67,7 @@
 button.save = 저장
 button.selectAll = 전체 선택
 button.selectFile = 파일 선택
+button.show.original = 원문 보기
 button.signup = {0} 시작 하기
 button.submitForm = 폼 전송
 button.upload = 파일 올리기
Add a comment
List