001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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    }