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 PORTAL_CONTENT_REVIEWER =
039                    "Portal Content Reviewer";
040    
041            public static final String POWER_USER = "Power User";
042    
043            public static final String SITE_ADMINISTRATOR = "Site Administrator";
044    
045            public static final String SITE_CONTENT_REVIEWER = "Site Content Reviewer";
046    
047            public static final String SITE_MEMBER = "Site Member";
048    
049            public static final String SITE_OWNER = "Site Owner";
050    
051            public static final String[] SYSTEM_ORGANIZATION_ROLES = {
052                    ORGANIZATION_ADMINISTRATOR, ORGANIZATION_OWNER, ORGANIZATION_USER
053            };
054    
055            public static final String[] SYSTEM_ROLES = {
056                    ADMINISTRATOR, GUEST, OWNER, POWER_USER, RoleConstants.USER
057            };
058    
059            public static final String[] SYSTEM_SITE_ROLES = {
060                    SITE_ADMINISTRATOR, SITE_MEMBER, SITE_OWNER
061            };
062    
063            public static final int TYPE_ORGANIZATION = 3;
064    
065            public static final String TYPE_ORGANIZATION_LABEL = "organization";
066    
067            public static final int TYPE_PROVIDER = 4;
068    
069            public static final int TYPE_REGULAR = 1;
070    
071            public static final String TYPE_REGULAR_LABEL = "regular";
072    
073            public static final int TYPE_SITE = 2;
074    
075            public static final String TYPE_SITE_LABEL = "site";
076    
077            public static final int[] TYPES_ORGANIZATION_AND_REGULAR =
078                    {TYPE_REGULAR, TYPE_ORGANIZATION};
079    
080            public static final int[] TYPES_ORGANIZATION_AND_REGULAR_AND_SITE = {
081                    TYPE_REGULAR, TYPE_ORGANIZATION, TYPE_SITE
082            };
083    
084            public static final int[] TYPES_REGULAR = {TYPE_REGULAR};
085    
086            public static final int[] TYPES_REGULAR_AND_SITE =
087                    {TYPE_REGULAR, TYPE_SITE};
088    
089            public static final String USER = "User";
090    
091            public static String getTypeLabel(int type) {
092                    if (type == TYPE_ORGANIZATION) {
093                            return TYPE_ORGANIZATION_LABEL;
094                    }
095                    else if (type == TYPE_SITE) {
096                            return TYPE_SITE_LABEL;
097                    }
098                    else {
099                            return TYPE_REGULAR_LABEL;
100                    }
101            }
102    
103    }