001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.impl;
022:
023: import com.liferay.portal.PortalException;
024: import com.liferay.portal.SystemException;
025: import com.liferay.portal.model.Company;
026: import com.liferay.portal.model.impl.RoleImpl;
027: import com.liferay.portal.security.auth.PrincipalException;
028: import com.liferay.portal.service.base.CompanyServiceBaseImpl;
029:
030: import java.io.File;
031:
032: /**
033: * <a href="CompanyServiceImpl.java.html"><b><i>View Source</i></b></a>
034: *
035: * @author Brian Wing Shun Chan
036: *
037: */
038: public class CompanyServiceImpl extends CompanyServiceBaseImpl {
039:
040: public Company addCompany(String webId, String virtualHost,
041: String mx) throws PortalException, SystemException {
042:
043: if (!getPermissionChecker().isOmniadmin()) {
044: throw new PrincipalException();
045: }
046:
047: return companyLocalService.addCompany(webId, virtualHost, mx);
048: }
049:
050: public Company updateCompany(long companyId, String virtualHost,
051: String mx) throws PortalException, SystemException {
052:
053: if (!getPermissionChecker().isOmniadmin()) {
054: throw new PrincipalException();
055: }
056:
057: return companyLocalService.updateCompany(companyId,
058: virtualHost, mx);
059: }
060:
061: public Company updateCompany(long companyId, String virtualHost,
062: String mx, String name, String legalName, String legalId,
063: String legalType, String sicCode, String tickerSymbol,
064: String industry, String type, String size)
065: throws PortalException, SystemException {
066:
067: if (!roleLocalService.hasUserRole(getUserId(), companyId,
068: RoleImpl.ADMINISTRATOR, true)) {
069:
070: throw new PrincipalException();
071: }
072:
073: return companyLocalService.updateCompany(companyId,
074: virtualHost, mx, name, legalName, legalId, legalType,
075: sicCode, tickerSymbol, industry, type, size);
076: }
077:
078: public void updateDisplay(long companyId, String languageId,
079: String timeZoneId) throws PortalException, SystemException {
080:
081: if (!roleLocalService.hasUserRole(getUserId(), companyId,
082: RoleImpl.ADMINISTRATOR, true)) {
083:
084: throw new PrincipalException();
085: }
086:
087: companyLocalService.updateDisplay(companyId, languageId,
088: timeZoneId);
089: }
090:
091: public void updateLogo(long companyId, File file)
092: throws PortalException, SystemException {
093:
094: if (!roleLocalService.hasUserRole(getUserId(), companyId,
095: RoleImpl.ADMINISTRATOR, true)) {
096:
097: throw new PrincipalException();
098: }
099:
100: companyLocalService.updateLogo(companyId, file);
101: }
102:
103: public void updateSecurity(long companyId, String authType,
104: boolean autoLogin, boolean sendPassword, boolean strangers,
105: boolean strangersWithMx, boolean strangersVerify,
106: boolean communityLogo) throws PortalException,
107: SystemException {
108:
109: if (!roleLocalService.hasUserRole(getUserId(), companyId,
110: RoleImpl.ADMINISTRATOR, true)) {
111:
112: throw new PrincipalException();
113: }
114:
115: companyLocalService.updateSecurity(companyId, authType,
116: autoLogin, sendPassword, strangers, strangersWithMx,
117: strangersVerify, communityLogo);
118: }
119:
120: }
|