Coverage Report - org.kuali.student.common.rice.authorization.PermissionType
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionType
0%
0/38
0%
0/4
1.3
 
 1  
 /**
 2  
  * Copyright 2010 The Kuali Foundation Licensed under the
 3  
  * Educational Community License, Version 2.0 (the "License"); you may
 4  
  * not use this file except in compliance with the License. You may
 5  
  * obtain a copy of the License at
 6  
  *
 7  
  * http://www.osedu.org/licenses/ECL-2.0
 8  
  *
 9  
  * Unless required by applicable law or agreed to in writing,
 10  
  * software distributed under the License is distributed on an "AS IS"
 11  
  * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 12  
  * or implied. See the License for the specific language governing
 13  
  * permissions and limitations under the License.
 14  
  */
 15  
 
 16  
 package org.kuali.student.common.rice.authorization;
 17  
 
 18  
 /**
 19  
  * Enum to be used for Permission types. Permission Type is analagous to a permission template.
 20  
  * 
 21  
  * When using permission types, permission checks will be performed using template names. 
 22  
  *
 23  
  */
 24  0
 public enum PermissionType {
 25  0
         INITIATE("Initiate","KR-SYS","Initiate Document"),
 26  0
         OPEN("View","KS-SYS","Open Document"),
 27  0
         EDIT("Edit","KS-SYS","Edit Document"),
 28  0
         ADD_COMMENT("Comment","KS-SYS","Comment on Document"),
 29  0
         ADD_ADHOC_REVIEWER("Add Reviewer","KS-SYS","Add Adhoc Reviewer"), 
 30  0
         WITHDRAW("Withdraw","KS-SYS","Withdraw Document"),
 31  0
         SECTION_MAINTENANCE("Section Maintenance","KS-SYS","Section Maintenance"), 
 32  0
         FIELD_ACCESS("Access Permission","KS-SYS","Access Permission"), 
 33  0
         SEARCH("Lookup",null,null),
 34  0
         REMOVE_ADHOC_REVIEWERS("Remove Reviewers","KS-SYS","Remove Reviewers"), 
 35  0
         BLANKET_APPROVE("Blanket Approve","KS-SYS","Blanket Approve"),
 36  0
         UPLOAD_DOCUMENTS("Upload","KS-SYS","Upload to Document"),
 37  0
         USE_SCREEN("Use Screen","KS-SYS","Use Screen"),
 38  0
         ADD_COLLABORATOR_ACTION("Add Collaborator Action","KS-SYS","Add Collaborator Action");
 39  
 
 40  0
         private String label = "";
 41  0
         private String permissionNamespace = "";
 42  0
         private String permissionTemplateName = "";
 43  
 
 44  0
         private PermissionType(String label, String permissionNamespace, String permissionTemplateName) {
 45  0
         this.label = label;
 46  0
         this.permissionNamespace = permissionNamespace;
 47  0
         this.permissionTemplateName = permissionTemplateName;
 48  0
     }
 49  
 
 50  
         public String getLabel() {
 51  0
             return label;
 52  
     }
 53  
 
 54  
         public void setLabel(String label) {
 55  0
             this.label = label;
 56  0
     }
 57  
 
 58  
         public String getPermissionNamespace() {
 59  0
             return permissionNamespace;
 60  
     }
 61  
 
 62  
         public void setPermissionNamespace(String permissionNamespace) {
 63  0
             this.permissionNamespace = permissionNamespace;
 64  0
     }
 65  
 
 66  
         public String getPermissionTemplateName() {
 67  0
             return permissionTemplateName;
 68  
     }
 69  
 
 70  
         public void setPermissionTemplateName(String permissionTemplateName) {
 71  0
             this.permissionTemplateName = permissionTemplateName;
 72  0
     }
 73  
 
 74  
         public String getCode() {
 75  0
                 return permissionNamespace + "~" + permissionTemplateName;
 76  
         }
 77  
 
 78  
         public static PermissionType getByCode(String code) {
 79  0
                 for (PermissionType type : PermissionType.values()) {
 80  0
                         if (type.getCode().equals(code)) {
 81  0
                                 return type;
 82  
                         }
 83  
                 }
 84  0
                 return null;
 85  
         }
 86  
 
 87  
         @Override
 88  
     public String toString() {
 89  0
         return label;
 90  
     }
 91  
 }