001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.service.impl;
016    
017    import com.liferay.portal.kernel.exception.PortalException;
018    import com.liferay.portal.model.PasswordPolicy;
019    import com.liferay.portal.security.permission.ActionKeys;
020    import com.liferay.portal.service.ServiceContext;
021    import com.liferay.portal.service.base.PasswordPolicyServiceBaseImpl;
022    import com.liferay.portal.service.permission.PasswordPolicyPermissionUtil;
023    import com.liferay.portal.service.permission.PortalPermissionUtil;
024    
025    /**
026     * @author Scott Lee
027     */
028    public class PasswordPolicyServiceImpl extends PasswordPolicyServiceBaseImpl {
029    
030            /**
031             * @deprecated As of 6.2.0, replaced by {@link #addPasswordPolicy(String,
032             *             String, boolean, boolean, long, boolean, boolean, int, int,
033             *             int, int, int, int, String, boolean, int, boolean, long,
034             *             long, int, boolean, int, long, long, long, ServiceContext)}
035             */
036            @Deprecated
037            @Override
038            public PasswordPolicy addPasswordPolicy(
039                            String name, String description, boolean changeable,
040                            boolean changeRequired, long minAge, boolean checkSyntax,
041                            boolean allowDictionaryWords, int minAlphanumeric, int minLength,
042                            int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
043                            boolean history, int historyCount, boolean expireable, long maxAge,
044                            long warningTime, int graceLimit, boolean lockout, int maxFailure,
045                            long lockoutDuration, long resetFailureCount,
046                            long resetTicketMaxAge)
047                    throws PortalException {
048    
049                    PortalPermissionUtil.check(
050                            getPermissionChecker(), ActionKeys.ADD_PASSWORD_POLICY);
051    
052                    return passwordPolicyLocalService.addPasswordPolicy(
053                            getUserId(), false, name, description, changeable, changeRequired,
054                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
055                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
056                            history, historyCount, expireable, maxAge, warningTime, graceLimit,
057                            lockout, maxFailure, lockoutDuration, resetFailureCount,
058                            resetTicketMaxAge);
059            }
060    
061            @Override
062            public PasswordPolicy addPasswordPolicy(
063                            String name, String description, boolean changeable,
064                            boolean changeRequired, long minAge, boolean checkSyntax,
065                            boolean allowDictionaryWords, int minAlphanumeric, int minLength,
066                            int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
067                            String regex, boolean history, int historyCount, boolean expireable,
068                            long maxAge, long warningTime, int graceLimit, boolean lockout,
069                            int maxFailure, long lockoutDuration, long resetFailureCount,
070                            long resetTicketMaxAge, ServiceContext serviceContext)
071                    throws PortalException {
072    
073                    PortalPermissionUtil.check(
074                            getPermissionChecker(), ActionKeys.ADD_PASSWORD_POLICY);
075    
076                    return passwordPolicyLocalService.addPasswordPolicy(
077                            getUserId(), false, name, description, changeable, changeRequired,
078                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
079                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
080                            regex, history, historyCount, expireable, maxAge, warningTime,
081                            graceLimit, lockout, maxFailure, lockoutDuration, resetFailureCount,
082                            resetTicketMaxAge, serviceContext);
083            }
084    
085            @Override
086            public void deletePasswordPolicy(long passwordPolicyId)
087                    throws PortalException {
088    
089                    PasswordPolicyPermissionUtil.check(
090                            getPermissionChecker(), passwordPolicyId, ActionKeys.DELETE);
091    
092                    passwordPolicyLocalService.deletePasswordPolicy(passwordPolicyId);
093            }
094    
095            /**
096             * @deprecated As of 6.2.0, replaced by {@link #updatePasswordPolicy(long,
097             *             String, String, boolean, boolean, long, boolean, boolean,
098             *             int, int, int, int, int, int, String, boolean, int, boolean,
099             *             long, long, int, boolean, int, long, long, long,
100             *             ServiceContext)}
101             */
102            @Deprecated
103            @Override
104            public PasswordPolicy updatePasswordPolicy(
105                            long passwordPolicyId, String name, String description,
106                            boolean changeable, boolean changeRequired, long minAge,
107                            boolean checkSyntax, boolean allowDictionaryWords,
108                            int minAlphanumeric, int minLength, int minLowerCase,
109                            int minNumbers, int minSymbols, int minUpperCase, boolean history,
110                            int historyCount, boolean expireable, long maxAge, long warningTime,
111                            int graceLimit, boolean lockout, int maxFailure,
112                            long lockoutDuration, long resetFailureCount,
113                            long resetTicketMaxAge)
114                    throws PortalException {
115    
116                    PasswordPolicyPermissionUtil.check(
117                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
118    
119                    return passwordPolicyLocalService.updatePasswordPolicy(
120                            passwordPolicyId, name, description, changeable, changeRequired,
121                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
122                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
123                            history, historyCount, expireable, maxAge, warningTime, graceLimit,
124                            lockout, maxFailure, lockoutDuration, resetFailureCount,
125                            resetTicketMaxAge);
126            }
127    
128            @Override
129            public PasswordPolicy updatePasswordPolicy(
130                            long passwordPolicyId, String name, String description,
131                            boolean changeable, boolean changeRequired, long minAge,
132                            boolean checkSyntax, boolean allowDictionaryWords,
133                            int minAlphanumeric, int minLength, int minLowerCase,
134                            int minNumbers, int minSymbols, int minUpperCase, String regex,
135                            boolean history, int historyCount, boolean expireable, long maxAge,
136                            long warningTime, int graceLimit, boolean lockout, int maxFailure,
137                            long lockoutDuration, long resetFailureCount,
138                            long resetTicketMaxAge, ServiceContext serviceContext)
139                    throws PortalException {
140    
141                    PasswordPolicyPermissionUtil.check(
142                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
143    
144                    return passwordPolicyLocalService.updatePasswordPolicy(
145                            passwordPolicyId, name, description, changeable, changeRequired,
146                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
147                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
148                            regex, history, historyCount, expireable, maxAge, warningTime,
149                            graceLimit, lockout, maxFailure, lockoutDuration, resetFailureCount,
150                            resetTicketMaxAge, serviceContext);
151            }
152    
153    }