View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.core.workflow.api;
20  
21  import org.apache.commons.lang3.tuple.Pair;
22  import org.apache.syncope.common.lib.request.UserCR;
23  import org.apache.syncope.common.lib.request.UserUR;
24  import org.apache.syncope.core.provisioning.api.UserWorkflowResult;
25  
26  /**
27   * Interface for calling underlying workflow implementations.
28   */
29  public interface UserWorkflowAdapter extends WorkflowAdapter {
30  
31      /**
32       * Create an user.
33       *
34       * @param userCR user to be created and whether to propagate it as active
35       * @param creator username that requested this operation
36       * @param context context information
37       * @return user just created
38       */
39      UserWorkflowResult<Pair<String, Boolean>> create(UserCR userCR, String creator, String context);
40  
41      /**
42       * Create an user, optionally disabling password policy check.
43       *
44       * @param userCR user to be created and whether to propagate it as active
45       * @param disablePwdPolicyCheck disable password policy check?
46       * @param enabled specify true/false to force active/supended status
47       * @param creator username that requested this operation
48       * @param context context information
49       * @return user just created
50       */
51      UserWorkflowResult<Pair<String, Boolean>> create(
52              UserCR userCR, boolean disablePwdPolicyCheck, Boolean enabled, String creator, String context);
53  
54      /**
55       * Activate an user.
56       *
57       * @param userKey user to be activated
58       * @param token to be verified for activation
59       * @param updater username that requested this operation
60       * @param context context information
61       * @return user just updated
62       */
63      UserWorkflowResult<String> activate(String userKey, String token, String updater, String context);
64  
65      /**
66       * Update an user.
67       *
68       * @param userUR modification set to be performed
69       * @param enabled whether status shall be changed or not
70       * @param updater username that requested this operation
71       * @param context context information
72       * @return user just updated and propagations to be performed
73       */
74      UserWorkflowResult<Pair<UserUR, Boolean>> update(UserUR userUR, Boolean enabled, String updater, String context);
75  
76      /**
77       * Suspend an user.
78       *
79       * @param key to be suspended
80       * @param updater username that requested this operation
81       * @param context context information
82       * @return user just suspended
83       */
84      UserWorkflowResult<String> suspend(String key, String updater, String context);
85  
86      /**
87       * Suspend an user (used by internal authentication process)
88       *
89       * @param key to be suspended
90       * @param updater username that requested this operation
91       * @param context context information
92       * @return user just suspended and information whether to propagate suspension
93       */
94      Pair<UserWorkflowResult<String>, Boolean> internalSuspend(String key, String updater, String context);
95  
96      /**
97       * Reactivate an user.
98       *
99       * @param userKey user to be reactivated
100      * @param updater username that requested this operation
101      * @param context context information
102      * @return user just reactivated
103      */
104     UserWorkflowResult<String> reactivate(String userKey, String updater, String context);
105 
106     /**
107      * Request password reset for an user.
108      *
109      * @param userKey user requesting password reset
110      * @param updater username that requested this operation
111      * @param context context information
112      */
113     void requestPasswordReset(String userKey, String updater, String context);
114 
115     /**
116      * Confirm password reset for an user.
117      *
118      * @param userKey user confirming password reset
119      * @param token security token
120      * @param password new password value
121      * @param updater username that requested this operation
122      * @param context context information
123      * @return user just updated and propagations to be performed
124      */
125     UserWorkflowResult<Pair<UserUR, Boolean>> confirmPasswordReset(
126             String userKey, String token, String password, String updater, String context);
127 
128     /**
129      * Delete an user.
130      *
131      * @param userKey user to be deleted
132      * @param eraser username that requested this operation
133      * @param context context information
134      */
135     void delete(String userKey, String eraser, String context);
136 }