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