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
42 public Company addCompany(String webId, String virtualHost, String mx)
43 throws PortalException, SystemException {
44
45 if (!getPermissionChecker().isOmniadmin()) {
46 throw new PrincipalException();
47 }
48
49 return companyLocalService.addCompany(webId, virtualHost, mx);
50 }
51
52 public Company addCompany(
53 String webId, String virtualHost, String mx, String shardName,
54 boolean system)
55 throws PortalException, SystemException {
56
57 if (!getPermissionChecker().isOmniadmin()) {
58 throw new PrincipalException();
59 }
60
61 return companyLocalService.addCompany(
62 webId, virtualHost, mx, shardName, system);
63 }
64
65 public Company updateCompany(long companyId, String virtualHost, String mx)
66 throws PortalException, SystemException {
67
68 if (!getPermissionChecker().isOmniadmin()) {
69 throw new PrincipalException();
70 }
71
72 return companyLocalService.updateCompany(companyId, virtualHost, mx);
73 }
74
75 public Company updateCompany(
76 long companyId, String virtualHost, String mx, String name,
77 String legalName, String legalId, String legalType, String sicCode,
78 String tickerSymbol, String industry, String type, String size)
79 throws PortalException, SystemException {
80
81 if (!roleLocalService.hasUserRole(
82 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
83
84 throw new PrincipalException();
85 }
86
87 return companyLocalService.updateCompany(
88 companyId, virtualHost, mx, name, legalName, legalId, legalType,
89 sicCode, tickerSymbol, industry, type, size);
90 }
91
92 public void updateDisplay(
93 long companyId, String languageId, String timeZoneId)
94 throws PortalException, SystemException {
95
96 if (!roleLocalService.hasUserRole(
97 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
98
99 throw new PrincipalException();
100 }
101
102 companyLocalService.updateDisplay(companyId, languageId, timeZoneId);
103 }
104
105 public void updateLogo(long companyId, File file)
106 throws PortalException, SystemException {
107
108 if (!roleLocalService.hasUserRole(
109 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
110
111 throw new PrincipalException();
112 }
113
114 companyLocalService.updateLogo(companyId, file);
115 }
116
117 public void updateSecurity(
118 long companyId, String authType, boolean autoLogin,
119 boolean sendPassword, boolean strangers, boolean strangersWithMx,
120 boolean strangersVerify, boolean communityLogo)
121 throws PortalException, SystemException {
122
123 if (!roleLocalService.hasUserRole(
124 getUserId(), companyId, RoleConstants.ADMINISTRATOR, true)) {
125
126 throw new PrincipalException();
127 }
128
129 companyLocalService.updateSecurity(
130 companyId, authType, autoLogin, sendPassword, strangers,
131 strangersWithMx, strangersVerify, communityLogo);
132 }
133
134 }