001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.model;
016    
017    /**
018     * Contains constants used by roles, including the names of the default roles
019     * and the role types.
020     *
021     * @author Brian Wing Shun Chan
022     */
023    public class RoleConstants {
024    
025            public static final String ADMINISTRATOR = "Administrator";
026    
027            public static final String GUEST = "Guest";
028    
029            public static final String ORGANIZATION_ADMINISTRATOR =
030                    "Organization Administrator";
031    
032            public static final String ORGANIZATION_OWNER = "Organization Owner";
033    
034            public static final String ORGANIZATION_USER = "Organization User";
035    
036            public static final String OWNER = "Owner";
037    
038            public static final String POWER_USER = "Power User";
039    
040            public static final String SITE_ADMINISTRATOR = "Site Administrator";
041    
042            public static final String SITE_MEMBER = "Site Member";
043    
044            public static final String SITE_OWNER = "Site Owner";
045    
046            public static final String[] SYSTEM_ORGANIZATION_ROLES = {
047                    ORGANIZATION_ADMINISTRATOR, ORGANIZATION_OWNER, ORGANIZATION_USER
048            };
049    
050            public static final String[] SYSTEM_ROLES = {
051                    ADMINISTRATOR, GUEST, OWNER, POWER_USER, RoleConstants.USER
052            };
053    
054            public static final String[] SYSTEM_SITE_ROLES = {
055                    SITE_ADMINISTRATOR, SITE_MEMBER, SITE_OWNER
056            };
057    
058            public static final int TYPE_ORGANIZATION = 3;
059    
060            public static final String TYPE_ORGANIZATION_LABEL = "organization";
061    
062            public static final int TYPE_PROVIDER = 4;
063    
064            public static final int TYPE_REGULAR = 1;
065    
066            public static final String TYPE_REGULAR_LABEL = "regular";
067    
068            public static final int TYPE_SITE = 2;
069    
070            public static final String TYPE_SITE_LABEL = "site";
071    
072            public static final String USER = "User";
073    
074            public static String getTypeLabel(int type) {
075                    if (type == TYPE_ORGANIZATION) {
076                            return TYPE_ORGANIZATION_LABEL;
077                    }
078                    else if (type == TYPE_SITE) {
079                            return TYPE_SITE_LABEL;
080                    }
081                    else {
082                            return TYPE_REGULAR_LABEL;
083                    }
084            }
085    
086    }