Coverage Report - org.kuali.student.common.rice.authorization.PermissionType
 
Classes in this File Line Coverage Branch Coverage Complexity
PermissionType
0%
0/37
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  
 
 39  0
         private String label = "";
 40  0
         private String permissionNamespace = "";
 41  0
         private String permissionTemplateName = "";
 42  
 
 43  0
         private PermissionType(String label, String permissionNamespace, String permissionTemplateName) {
 44  0
         this.label = label;
 45  0
         this.permissionNamespace = permissionNamespace;
 46  0
         this.permissionTemplateName = permissionTemplateName;
 47  0
     }
 48  
 
 49  
         public String getLabel() {
 50  0
             return label;
 51  
     }
 52  
 
 53  
         public void setLabel(String label) {
 54  0
             this.label = label;
 55  0
     }
 56  
 
 57  
         public String getPermissionNamespace() {
 58  0
             return permissionNamespace;
 59  
     }
 60  
 
 61  
         public void setPermissionNamespace(String permissionNamespace) {
 62  0
             this.permissionNamespace = permissionNamespace;
 63  0
     }
 64  
 
 65  
         public String getPermissionTemplateName() {
 66  0
             return permissionTemplateName;
 67  
     }
 68  
 
 69  
         public void setPermissionTemplateName(String permissionTemplateName) {
 70  0
             this.permissionTemplateName = permissionTemplateName;
 71  0
     }
 72  
 
 73  
         public String getCode() {
 74  0
                 return permissionNamespace + "~" + permissionTemplateName;
 75  
         }
 76  
 
 77  
         public static PermissionType getByCode(String code) {
 78  0
                 for (PermissionType type : PermissionType.values()) {
 79  0
                         if (type.getCode().equals(code)) {
 80  0
                                 return type;
 81  
                         }
 82  
                 }
 83  0
                 return null;
 84  
         }
 85  
 
 86  
         @Override
 87  
     public String toString() {
 88  0
         return label;
 89  
     }
 90  
 }