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 updater username that requested this operation
70       * @param context context information
71       * @return user just updated and propagations to be performed
72       */
73      UserWorkflowResult<Pair<UserUR, Boolean>> update(UserUR userUR, String updater, String context);
74  
75      /**
76       * Suspend an user.
77       *
78       * @param key to be suspended
79       * @param updater username that requested this operation
80       * @param context context information
81       * @return user just suspended
82       */
83      UserWorkflowResult<String> suspend(String key, String updater, String context);
84  
85      /**
86       * Suspend an user (used by internal authentication process)
87       *
88       * @param key to be suspended
89       * @param updater username that requested this operation
90       * @param context context information
91       * @return user just suspended and information whether to propagate suspension
92       */
93      Pair<UserWorkflowResult<String>, Boolean> internalSuspend(String key, String updater, String context);
94  
95      /**
96       * Reactivate an user.
97       *
98       * @param userKey user to be reactivated
99       * @param updater username that requested this operation
100      * @param context context information
101      * @return user just reactivated
102      */
103     UserWorkflowResult<String> reactivate(String userKey, String updater, String context);
104 
105     /**
106      * Request password reset for an user.
107      *
108      * @param userKey user requesting password reset
109      * @param updater username that requested this operation
110      * @param context context information
111      */
112     void requestPasswordReset(String userKey, String updater, String context);
113 
114     /**
115      * Confirm password reset for an user.
116      *
117      * @param userKey user confirming password reset
118      * @param token security token
119      * @param password new password value
120      * @param updater username that requested this operation
121      * @param context context information
122      * @return user just updated and propagations to be performed
123      */
124     UserWorkflowResult<Pair<UserUR, Boolean>> confirmPasswordReset(
125             String userKey, String token, String password, String updater, String context);
126 
127     /**
128      * Delete an user.
129      *
130      * @param userKey user to be deleted
131      * @param eraser username that requested this operation
132      * @param context context information
133      */
134     void delete(String userKey, String eraser, String context);
135 }