1
19
20 package com.liferay.portal.service.impl;
21
22 import com.liferay.portal.PortalException;
23 import com.liferay.portal.SystemException;
24 import com.liferay.portal.model.Company;
25 import com.liferay.portal.model.RoleConstants;
26 import com.liferay.portal.security.auth.PrincipalException;
27 import com.liferay.portal.service.base.CompanyServiceBaseImpl;
28
29 import java.io.File;
30
31
37 public class CompanyServiceImpl extends CompanyServiceBaseImpl {
38
39 public Company addCompany(String webId, String virtualHost, String mx)
40 throws PortalException, SystemException {
41
42 if (!getPermissionChecker().isOmniadmin()) {
43 throw new PrincipalException();
44 }
45
46 return companyLocalService.addCompany(webId, virtualHost, mx);
47 }
48
49 public Company updateCompany(long companyId, String virtualHost, String mx)
50 throws PortalException, SystemException {
51
52 if (!getPermissionChecker().isOmniadmin()) {
53 throw new PrincipalException();
54 }
55
56 return companyLocalService.updateCompany(companyId, virtualHost, mx);
57 }
58
59 public Company updateCompany(
60 long companyId, String virtualHost, String mx, String name,
61 String legalName, String legalId, String legalType, String sicCode,
62 String tickerSymbol, String industry, String type, String size)
63 throws PortalException, SystemException {
64
65 if (!roleLocalService.hasUserRole(
66 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
67
68 throw new PrincipalException();
69 }
70
71 return companyLocalService.updateCompany(
72 companyId, virtualHost, mx, name, legalName, legalId, legalType,
73 sicCode, tickerSymbol, industry, type, size);
74 }
75
76 public void updateDisplay(
77 long companyId, String languageId, String timeZoneId)
78 throws PortalException, SystemException {
79
80 if (!roleLocalService.hasUserRole(
81 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
82
83 throw new PrincipalException();
84 }
85
86 companyLocalService.updateDisplay(companyId, languageId, timeZoneId);
87 }
88
89 public void updateLogo(long companyId, File file)
90 throws PortalException, SystemException {
91
92 if (!roleLocalService.hasUserRole(
93 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
94
95 throw new PrincipalException();
96 }
97
98 companyLocalService.updateLogo(companyId, file);
99 }
100
101 public void updateSecurity(
102 long companyId, String authType, boolean autoLogin,
103 boolean sendPassword, boolean strangers, boolean strangersWithMx,
104 boolean strangersVerify, boolean communityLogo)
105 throws PortalException, SystemException {
106
107 if (!roleLocalService.hasUserRole(
108 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
109
110 throw new PrincipalException();
111 }
112
113 companyLocalService.updateSecurity(
114 companyId, authType, autoLogin, sendPassword, strangers,
115 strangersWithMx, strangersVerify, communityLogo);
116 }
117
118 }