001    /**
002     * Copyright (c) 2000-2013 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.kernel.exception.SystemException;
019    import com.liferay.portal.model.PasswordPolicy;
020    import com.liferay.portal.security.permission.ActionKeys;
021    import com.liferay.portal.service.ServiceContext;
022    import com.liferay.portal.service.base.PasswordPolicyServiceBaseImpl;
023    import com.liferay.portal.service.permission.PasswordPolicyPermissionUtil;
024    import com.liferay.portal.service.permission.PortalPermissionUtil;
025    
026    /**
027     * @author Scott Lee
028     */
029    public class PasswordPolicyServiceImpl extends PasswordPolicyServiceBaseImpl {
030    
031            /**
032             * @deprecated As of 6.2.0, replaced by {@link #addPasswordPolicy(String,
033             *             String, boolean, boolean, long, boolean, boolean, int, int,
034             *             int, int, int, int, String, boolean, int, boolean, long,
035             *             long, int, boolean, int, long, long, long, ServiceContext)}
036             */
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, SystemException {
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, SystemException {
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, SystemException {
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            @Override
103            public PasswordPolicy updatePasswordPolicy(
104                            long passwordPolicyId, String name, String description,
105                            boolean changeable, boolean changeRequired, long minAge,
106                            boolean checkSyntax, boolean allowDictionaryWords,
107                            int minAlphanumeric, int minLength, int minLowerCase,
108                            int minNumbers, int minSymbols, int minUpperCase, boolean history,
109                            int historyCount, boolean expireable, long maxAge, long warningTime,
110                            int graceLimit, boolean lockout, int maxFailure,
111                            long lockoutDuration, long resetFailureCount,
112                            long resetTicketMaxAge)
113                    throws PortalException, SystemException {
114    
115                    PasswordPolicyPermissionUtil.check(
116                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
117    
118                    return passwordPolicyLocalService.updatePasswordPolicy(
119                            passwordPolicyId, name, description, changeable, changeRequired,
120                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
121                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
122                            history, historyCount, expireable, maxAge, warningTime, graceLimit,
123                            lockout, maxFailure, lockoutDuration, resetFailureCount,
124                            resetTicketMaxAge);
125            }
126    
127            @Override
128            public PasswordPolicy updatePasswordPolicy(
129                            long passwordPolicyId, String name, String description,
130                            boolean changeable, boolean changeRequired, long minAge,
131                            boolean checkSyntax, boolean allowDictionaryWords,
132                            int minAlphanumeric, int minLength, int minLowerCase,
133                            int minNumbers, int minSymbols, int minUpperCase, String regex,
134                            boolean history, int historyCount, boolean expireable, long maxAge,
135                            long warningTime, int graceLimit, boolean lockout, int maxFailure,
136                            long lockoutDuration, long resetFailureCount,
137                            long resetTicketMaxAge, ServiceContext serviceContext)
138                    throws PortalException, SystemException {
139    
140                    PasswordPolicyPermissionUtil.check(
141                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
142    
143                    return passwordPolicyLocalService.updatePasswordPolicy(
144                            passwordPolicyId, name, description, changeable, changeRequired,
145                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
146                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
147                            regex, history, historyCount, expireable, maxAge, warningTime,
148                            graceLimit, lockout, maxFailure, lockoutDuration, resetFailureCount,
149                            resetTicketMaxAge, serviceContext);
150            }
151    
152    }