1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
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.PasswordPolicy;
20  import com.liferay.portal.security.permission.ActionKeys;
21  import com.liferay.portal.service.base.PasswordPolicyServiceBaseImpl;
22  import com.liferay.portal.service.permission.PasswordPolicyPermissionUtil;
23  import com.liferay.portal.service.permission.PortalPermissionUtil;
24  
25  /**
26   * <a href="PasswordPolicyServiceImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Scott Lee
29   */
30  public class PasswordPolicyServiceImpl extends PasswordPolicyServiceBaseImpl {
31  
32      public PasswordPolicy addPasswordPolicy(
33              String name, String description, boolean changeable,
34              boolean changeRequired, long minAge, boolean checkSyntax,
35              boolean allowDictionaryWords, int minLength, boolean history,
36              int historyCount, boolean expireable, long maxAge, long warningTime,
37              int graceLimit, boolean lockout, int maxFailure,
38              long lockoutDuration, long resetFailureCount)
39          throws PortalException, SystemException {
40  
41          PortalPermissionUtil.check(
42              getPermissionChecker(), ActionKeys.ADD_PASSWORD_POLICY);
43  
44          return passwordPolicyLocalService.addPasswordPolicy(
45              getUserId(), false, name, description, changeable, changeRequired,
46              minAge, checkSyntax, allowDictionaryWords, minLength, history,
47              historyCount, expireable, maxAge, warningTime, graceLimit, lockout,
48              maxFailure, lockoutDuration, resetFailureCount);
49      }
50  
51      public void deletePasswordPolicy(long passwordPolicyId)
52          throws PortalException, SystemException {
53  
54          PasswordPolicyPermissionUtil.check(
55              getPermissionChecker(), passwordPolicyId, ActionKeys.DELETE);
56  
57          passwordPolicyLocalService.deletePasswordPolicy(passwordPolicyId);
58      }
59  
60      public PasswordPolicy updatePasswordPolicy(
61              long passwordPolicyId, String name, String description,
62              boolean changeable, boolean changeRequired, long minAge,
63              boolean checkSyntax, boolean allowDictionaryWords, int minLength,
64              boolean history, int historyCount, boolean expireable, long maxAge,
65              long warningTime, int graceLimit, boolean lockout, int maxFailure,
66              long lockoutDuration, long resetFailureCount)
67          throws PortalException, SystemException {
68  
69          PasswordPolicyPermissionUtil.check(
70              getPermissionChecker(), passwordPolicyId, ActionKeys.UPDATE);
71  
72          return passwordPolicyLocalService.updatePasswordPolicy(
73              passwordPolicyId, name, description, changeable, changeRequired,
74              minAge, checkSyntax, allowDictionaryWords, minLength, history,
75              historyCount, expireable, maxAge, warningTime, graceLimit, lockout,
76              maxFailure, lockoutDuration, resetFailureCount);
77      }
78  
79  }