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