KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jcorporate > expresso > core > security > SuperUser


1 /* The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
2 *
3 * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
15 * distribution.
16 *
17 * 3. The end-user documentation included with the redistribution,
18 * if any, must include the following acknowledgment:
19 * "This product includes software developed by Jcorporate Ltd.
20 * (http://www.jcorporate.com/)."
21 * Alternately, this acknowledgment may appear in the software itself,
22 * if and wherever such third-party acknowledgments normally appear.
23 *
24 * 4. "Jcorporate" and product names such as "Expresso" must
25 * not be used to endorse or promote products derived from this
26 * software without prior written permission. For written permission,
27 * please contact info@jcorporate.com.
28 *
29 * 5. Products derived from this software may not be called "Expresso",
30 * or other Jcorporate product names; nor may "Expresso" or other
31 * Jcorporate product names appear in their name, without prior
32 * written permission of Jcorporate Ltd.
33 *
34 * 6. No product derived from this software may compete in the same
35 * market space, i.e. framework, without prior written permission
36 * of Jcorporate Ltd. For written permission, please contact
37 * partners@jcorporate.com.
38 *
39 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
40 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42 * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
43 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
45 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
46 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
48 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
49 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50 * SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This software consists of voluntary contributions made by many
54 * individuals on behalf of the Jcorporate Ltd. Contributions back
55 * to the project(s) are encouraged when you make modifications.
56 * Please send them to support@jcorporate.com. For more information
57 * on Jcorporate Ltd. and its products, please see
58 * <http://www.jcorporate.com/>.
59 *
60 * Portions of this software are based upon other open source
61 * products and are subject to their respective licenses.
62  */

63
64 package com.jcorporate.expresso.core.security;
65
66 import com.jcorporate.expresso.core.dataobjects.Securable;
67 import com.jcorporate.expresso.core.db.DBException;
68
69 /**
70  * This is a user that represents a SuperUser. A SuperUser User has an
71  * is == SecuredDBObject.SYSTEM_ACCOUNT, but is encapulated in the Expresso
72  * User object. It is mainly used while systems are setting up so that
73  * no arg dbobjects can be constructed before the registry can be truly set.
74  *
75  * @author Michael Rimov
76  * @version 1.0
77  */

78 public class SuperUser extends User {
79     protected SuperUser() {
80         super();
81     }
82
83     public static final User SUPER_USER;
84
85     static {
86         try {
87             SUPER_USER = new User(new MapBasedUserInfo());
88             SUPER_USER.setDBName("default");
89             SUPER_USER.setUid(Securable.SYSTEM_ACCOUNT);
90             SUPER_USER.setLoginName("$NONE$");
91             //We need to do this JUST IN CASE somebody tries to log
92
//in with it.
93
SUPER_USER.setAccountStatus(User.INACTIVE_ACCOUNT_STATUS);
94             SUPER_USER.setDisplayName("System Account");
95             SUPER_USER.setEmail("noname@example.org");
96         } catch (DBException ex) {
97             throw new RuntimeException JavaDoc("Error setting up super user");
98         }
99     }
100
101 }
102
Popular Tags