001    /**
002     * Copyright (c) 2000-2012 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.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
032             */
033            public PasswordPolicy addPasswordPolicy(
034                            String name, String description, boolean changeable,
035                            boolean changeRequired, long minAge, boolean checkSyntax,
036                            boolean allowDictionaryWords, int minAlphanumeric, int minLength,
037                            int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
038                            boolean history, int historyCount, boolean expireable, long maxAge,
039                            long warningTime, int graceLimit, boolean lockout, int maxFailure,
040                            long lockoutDuration, long resetFailureCount,
041                            long resetTicketMaxAge)
042                    throws PortalException, SystemException {
043    
044                    PortalPermissionUtil.check(
045                            getPermissionChecker(), ActionKeys.ADD_PASSWORD_POLICY);
046    
047                    return passwordPolicyLocalService.addPasswordPolicy(
048                            getUserId(), false, name, description, changeable, changeRequired,
049                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
050                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
051                            history, historyCount, expireable, maxAge, warningTime, graceLimit,
052                            lockout, maxFailure, lockoutDuration, resetFailureCount,
053                            resetTicketMaxAge);
054            }
055    
056            public PasswordPolicy addPasswordPolicy(
057                            String name, String description, boolean changeable,
058                            boolean changeRequired, long minAge, boolean checkSyntax,
059                            boolean allowDictionaryWords, int minAlphanumeric, int minLength,
060                            int minLowerCase, int minNumbers, int minSymbols, int minUpperCase,
061                            String regex, boolean history, int historyCount, boolean expireable,
062                            long maxAge, long warningTime, int graceLimit, boolean lockout,
063                            int maxFailure, long lockoutDuration, long resetFailureCount,
064                            long resetTicketMaxAge)
065                    throws PortalException, SystemException {
066    
067                    PortalPermissionUtil.check(
068                            getPermissionChecker(), ActionKeys.ADD_PASSWORD_POLICY);
069    
070                    return passwordPolicyLocalService.addPasswordPolicy(
071                            getUserId(), false, name, description, changeable, changeRequired,
072                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
073                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
074                            regex, history, historyCount, expireable, maxAge, warningTime,
075                            graceLimit, lockout, maxFailure, lockoutDuration, resetFailureCount,
076                            resetTicketMaxAge);
077            }
078    
079            public void deletePasswordPolicy(long passwordPolicyId)
080                    throws PortalException, SystemException {
081    
082                    PasswordPolicyPermissionUtil.check(
083                            getPermissionChecker(), passwordPolicyId, ActionKeys.DELETE);
084    
085                    passwordPolicyLocalService.deletePasswordPolicy(passwordPolicyId);
086            }
087    
088            /**
089             * @deprecated
090             */
091            public PasswordPolicy updatePasswordPolicy(
092                            long passwordPolicyId, String name, String description,
093                            boolean changeable, boolean changeRequired, long minAge,
094                            boolean checkSyntax, boolean allowDictionaryWords,
095                            int minAlphanumeric, int minLength, int minLowerCase,
096                            int minNumbers, int minSymbols, int minUpperCase, boolean history,
097                            int historyCount, boolean expireable, long maxAge, long warningTime,
098                            int graceLimit, boolean lockout, int maxFailure,
099                            long lockoutDuration, long resetFailureCount,
100                            long resetTicketMaxAge)
101                    throws PortalException, SystemException {
102    
103                    PasswordPolicyPermissionUtil.check(
104                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
105    
106                    return passwordPolicyLocalService.updatePasswordPolicy(
107                            passwordPolicyId, name, description, changeable, changeRequired,
108                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
109                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
110                            history, historyCount, expireable, maxAge, warningTime, graceLimit,
111                            lockout, maxFailure, lockoutDuration, resetFailureCount,
112                            resetTicketMaxAge);
113            }
114    
115            public PasswordPolicy updatePasswordPolicy(
116                            long passwordPolicyId, String name, String description,
117                            boolean changeable, boolean changeRequired, long minAge,
118                            boolean checkSyntax, boolean allowDictionaryWords,
119                            int minAlphanumeric, int minLength, int minLowerCase,
120                            int minNumbers, int minSymbols, int minUpperCase, String regex,
121                            boolean history, int historyCount, boolean expireable, long maxAge,
122                            long warningTime, int graceLimit, boolean lockout, int maxFailure,
123                            long lockoutDuration, long resetFailureCount,
124                            long resetTicketMaxAge)
125                    throws PortalException, SystemException {
126    
127                    PasswordPolicyPermissionUtil.check(
128                            getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
129    
130                    return passwordPolicyLocalService.updatePasswordPolicy(
131                            passwordPolicyId, name, description, changeable, changeRequired,
132                            minAge, checkSyntax, allowDictionaryWords, minAlphanumeric,
133                            minLength, minLowerCase, minNumbers, minSymbols, minUpperCase,
134                            regex, history, historyCount, expireable, maxAge, warningTime,
135                            graceLimit, lockout, maxFailure, lockoutDuration, resetFailureCount,
136                            resetTicketMaxAge);
137            }
138    
139    }