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