KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > authorization > BasicAccessRuleSet


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.core.model.authorization;
15
16 /**
17  * A class containing constats used when configuring Basic Access Rule Set
18  *
19  * @author herrvendil
20  * @version $Id: BasicAccessRuleSet.java,v 1.2 2006/07/29 11:26:36 herrvendil Exp $
21  */

22 public class BasicAccessRuleSet implements java.io.Serializable JavaDoc {
23
24     public static final int ROLE_NONE = 0;
25     public static final int ROLE_SUPERADMINISTRATOR = 1;
26     public static final int ROLE_CAADMINISTRATOR = 2;
27     public static final int ROLE_RAADMINISTRATOR = 3;
28     public static final int ROLE_SUPERVISOR = 4;
29     public static final int ROLE_HARDTOKENISSUER = 5;
30
31     public static final int ENDENTITY_VIEW = 2;
32     public static final int ENDENTITY_VIEWHISTORY = 4;
33     public static final int ENDENTITY_VIEWHARDTOKENS = 8;
34     public static final int ENDENTITY_CREATE = 16;
35     public static final int ENDENTITY_EDIT = 32;
36     public static final int ENDENTITY_DELETE = 64;
37     public static final int ENDENTITY_REVOKE = 128;
38     public static final int ENDENTITY_KEYRECOVER = 256;
39     public static final int ENDENTITY_APPROVE = 512;
40     
41     public static final int ENDENTITYPROFILE_ALL = 0;
42     
43     public static final int CA_ALL = 0;
44     
45     public static final int OTHER_VIEWLOG = 1;
46     public static final int OTHER_ISSUEHARDTOKENS = 2;
47     
48     public static final String JavaDoc[] ROLETEXTS = {"NONE","SUPERADMINISTRATOR","CAADMINISTRATOR",
49                                                                      "RAADMINISTRATOR", "SUPERVISOR",
50                                                                      "HARDTOKENISSUER"};
51     
52     public static final String JavaDoc[] ENDENTITYRULETEXTS = {"VIEWENDENTITYRULE","VIEWHISTORYRULE","VIEWHARDTOKENRULE",
53                                                                                           "CREATEENDENTITYRULE","EDITENDENTITYRULE","DELETEENDENTITYRULE",
54                                                                                           "REVOKEENDENTITYRULE", "KEYRECOVERENDENTITYRULE",
55                                                                                           "APPROVEENDENTITYRULE"};
56             
57     public static final String JavaDoc[] OTHERTEXTS = {"","VIEWLOG","ISSUEHARDTOKENS"};
58         
59    /**
60      * This class should not be able to be instantiated.
61      */

62     private BasicAccessRuleSet(){}
63     
64     public static String JavaDoc getEndEntityRuleText(int endentityrule){
65         String JavaDoc returnval = "";
66         
67         switch(endentityrule){
68            case BasicAccessRuleSet.ENDENTITY_VIEW:
69               returnval = ENDENTITYRULETEXTS[0];
70               break;
71            case BasicAccessRuleSet.ENDENTITY_VIEWHISTORY:
72               returnval = ENDENTITYRULETEXTS[1];
73               break;
74            case BasicAccessRuleSet.ENDENTITY_VIEWHARDTOKENS:
75               returnval = ENDENTITYRULETEXTS[2];
76               break;
77            case BasicAccessRuleSet.ENDENTITY_CREATE:
78               returnval = ENDENTITYRULETEXTS[3];
79               break;
80            case BasicAccessRuleSet.ENDENTITY_EDIT:
81               returnval = ENDENTITYRULETEXTS[4];
82               break;
83            case BasicAccessRuleSet.ENDENTITY_DELETE:
84             returnval = ENDENTITYRULETEXTS[5];
85             break;
86            case BasicAccessRuleSet.ENDENTITY_REVOKE:
87               returnval = ENDENTITYRULETEXTS[6];
88               break;
89            case BasicAccessRuleSet.ENDENTITY_KEYRECOVER:
90             returnval = ENDENTITYRULETEXTS[7];
91             break;
92            case BasicAccessRuleSet.ENDENTITY_APPROVE:
93             returnval = ENDENTITYRULETEXTS[8];
94             break;
95         }
96         return returnval;
97     }
98     
99    
100 }
101
Popular Tags