001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (https://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software GmbH & Co. KG, please see the
018 * company website: https://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: https://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.db;
029
030import org.opencms.file.CmsDataAccessException;
031import org.opencms.file.CmsGroup;
032import org.opencms.file.CmsProject;
033import org.opencms.file.CmsResource;
034import org.opencms.file.CmsUser;
035import org.opencms.file.CmsUserSearchParameters;
036import org.opencms.main.CmsInitException;
037import org.opencms.security.CmsAccessControlEntry;
038import org.opencms.security.CmsOrganizationalUnit;
039import org.opencms.security.CmsPasswordEncryptionException;
040import org.opencms.util.CmsUUID;
041
042import java.util.List;
043import java.util.Map;
044
045/**
046 * Definitions of all required user driver methods. <p>
047 *
048 * @since 6.0.0
049 */
050public interface I_CmsUserDriver extends I_CmsDriver {
051
052    /** The type ID to identify user driver implementations. */
053    int DRIVER_TYPE_ID = 2;
054
055    /**
056     * Adds a resource to the given organizational unit.<p>
057     *
058     * @param dbc the current db context
059     * @param orgUnit the organizational unit to add the resource to
060     * @param resource the resource that is to be added to the organizational unit
061     *
062     * @throws CmsDataAccessException if something goes wrong
063     */
064    void addResourceToOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource)
065    throws CmsDataAccessException;
066
067    /**
068     * Counts the total number of users which match the given search criteria.<p>
069     *
070     * @param dbc the database context
071     * @param searchParams the search criteria
072     *
073     * @return the number of users which match the search criteria
074     *
075     * @throws CmsDataAccessException if something goes wrong
076     */
077    long countUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException;
078
079    /**
080     * Creates an access control entry.<p>
081     *
082     * @param dbc the current database context
083     * @param project the project to write the entry
084     * @param resource the id of the resource
085     * @param principal the id of the principal (user or group)
086     * @param allowed the bitset of allowed permissions
087     * @param denied the bitset of denied permissions
088     * @param flags flags
089     *
090     * @throws CmsDataAccessException if something goes wrong
091     */
092    void createAccessControlEntry(
093        CmsDbContext dbc,
094        CmsProject project,
095        CmsUUID resource,
096        CmsUUID principal,
097        int allowed,
098        int denied,
099        int flags)
100    throws CmsDataAccessException;
101
102    /**
103     * Creates a new group.<p>
104     *
105     * @param dbc the current database context
106     * @param groupId the id of the new group
107     * @param groupFqn the fully qualified name of the new group
108     * @param description The description for the new group
109     * @param flags the flags for the new group
110     * @param parentGroupName the name of the parent group (or null if the group has no parent)
111     *
112     * @return the created group
113     * @throws CmsDataAccessException if something goes wrong
114     */
115    CmsGroup createGroup(
116        CmsDbContext dbc,
117        CmsUUID groupId,
118        String groupFqn,
119        String description,
120        int flags,
121        String parentGroupName)
122    throws CmsDataAccessException;
123
124    /**
125     * Creates a new organizational unit.<p>
126     *
127     * @param dbc the current db context
128     * @param name the name of the new organizational unit
129     * @param description the description of the new organizational unit
130     * @param flags the flags for the new organizational unit
131     * @param parent the parent organizational unit (or <code>null</code>)
132     * @param associationRootPath the first associated resource
133     *
134     * @return a <code>{@link CmsOrganizationalUnit}</code> object representing
135     *          the newly created organizational unit
136     *
137     * @throws CmsDataAccessException if operation was not successful
138     */
139    CmsOrganizationalUnit createOrganizationalUnit(
140        CmsDbContext dbc,
141        String name,
142        String description,
143        int flags,
144        CmsOrganizationalUnit parent,
145        String associationRootPath)
146    throws CmsDataAccessException;
147
148    /**
149     * Creates the default root organizational unit.<p>
150     *
151     * @param dbc the current database context
152     */
153    void createRootOrganizationalUnit(CmsDbContext dbc);
154
155    /**
156     * Creates a new user.<p>
157     *
158     * @param dbc the current database context
159     * @param id the id of the user
160     * @param userFqn the fully qualified name of the new user
161     * @param password the already encripted user password
162     * @param firstname the user firstname
163     * @param lastname the user lastname
164     * @param email the user email
165     * @param lastlogin the user lastlogin time
166     * @param flags the user flags
167     * @param dateCreated the creation date
168     * @param additionalInfos the user additional infos
169     *
170     * @return the created user
171     *
172     * @throws CmsDataAccessException if something goes wrong
173     */
174    CmsUser createUser(
175        CmsDbContext dbc,
176        CmsUUID id,
177        String userFqn,
178        String password,
179        String firstname,
180        String lastname,
181        String email,
182        long lastlogin,
183        int flags,
184        long dateCreated,
185        Map<String, Object> additionalInfos)
186    throws CmsDataAccessException;
187
188    /**
189     * Adds a user to a group.<p>
190     *
191     * @param dbc the current database context
192     * @param userid the id of the user that is to be added to the group
193     * @param groupid the id of the group
194     *
195     * @throws CmsDataAccessException if operation was not successful
196     */
197    void createUserInGroup(CmsDbContext dbc, CmsUUID userid, CmsUUID groupid) throws CmsDataAccessException;
198
199    /**
200     * Deletes a group.<p>
201     *
202     * Only groups that contain no subgroups can be deleted.<p>
203     *
204     * @param dbc the current database context
205     * @param groupFqn the fully qualified name of the group that is to be deleted
206     *
207     * @throws CmsDataAccessException if something goes wrong
208     */
209    void deleteGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException;
210
211    /**
212     * Deletes an organizational unit.<p>
213     *
214     * Only organizational units that contain no suborganizational unit can be deleted.<p>
215     *
216     * @param dbc the current db context
217     * @param organizationalUnit the organizational unit to delete
218     *
219     * @throws CmsDataAccessException if operation was not successful
220     */
221    void deleteOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit)
222    throws CmsDataAccessException;
223
224    /**
225     * Deletes a user.<p>
226     *
227     * @param dbc the current database context
228     * @param userFqn the fully qualified name of the user to delete
229     *
230     * @throws CmsDataAccessException if something goes wrong
231     */
232    void deleteUser(CmsDbContext dbc, String userFqn) throws CmsDataAccessException;
233
234    /**
235     * Deletes the user additional information table.<p>
236     *
237     * @param dbc the current database context
238     * @param userId the id of the user to update
239     *
240     * @throws CmsDataAccessException if something goes wrong
241     */
242    void deleteUserInfos(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException;
243
244    /**
245     * Removes a user from a group.<p>
246     *
247     * @param dbc the current database context
248     * @param userId the id of the user that is to be removed from the group
249     * @param groupId the id of the group
250     *
251     * @throws CmsDataAccessException if something goes wrong
252     */
253    void deleteUserInGroup(CmsDbContext dbc, CmsUUID userId, CmsUUID groupId) throws CmsDataAccessException;
254
255    /**
256     * Destroys this driver.<p>
257     *
258     * @throws Throwable if something goes wrong
259     */
260    void destroy() throws Throwable;
261
262    /**
263     * Tests if a group with the specified name exists.<p>
264     *
265     * @param dbc the current database context
266     * @param groupFqn the fully qualified group name to be checked
267     *
268     * @return <code>true</code>, if a group with the specified name exists, <code>false</code> otherwise
269     *
270     * @throws CmsDataAccessException if something goes wrong
271     */
272    boolean existsGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException;
273
274    /**
275     * Tests if a user with the specified name exists.<p>
276     *
277     * @param dbc the current database context
278     * @param userFqn the fully qualified name of the user to be checked
279     *
280     * @return true, if a user with the specified name exists, false otherwise
281     * @throws CmsDataAccessException if something goes wrong
282     */
283    boolean existsUser(CmsDbContext dbc, String userFqn) throws CmsDataAccessException;
284
285    /**
286     * Initializes the default organizational units, users and groups.<p>
287     *
288     * @param dbc the current database context, be aware that this dbc has no runtime data!
289     *
290     * @throws CmsInitException if something goes wrong
291     */
292    void fillDefaults(CmsDbContext dbc) throws CmsInitException;
293
294    /**
295     * Returns all groups of the given organizational unit.<p>
296     *
297     * @param dbc the current db context
298     * @param orgUnit the organizational unit to get all groups for
299     * @param includeSubOus flag to signalize the retrieval of groups of sub-organizational units too
300     * @param readRoles if to read roles or groups
301     *
302     * @return all <code>{@link CmsGroup}</code> objects in the organizational unit
303     *
304     * @throws CmsDataAccessException if operation was not successful
305     */
306    List<CmsGroup> getGroups(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean includeSubOus, boolean readRoles)
307    throws CmsDataAccessException;
308
309    /**
310     * Returns all child organizational units of the given parent organizational unit including
311     * hierarchical deeper organization units if needed.<p>
312     *
313     * @param dbc the current db context
314     * @param parent the parent organizational unit, or <code>null</code> for the root
315     * @param includeChildren if hierarchical deeper organization units should also be returned
316     *
317     * @return a list of <code>{@link CmsOrganizationalUnit}</code> objects
318     *
319     * @throws CmsDataAccessException if operation was not succesful
320     */
321    List<CmsOrganizationalUnit> getOrganizationalUnits(
322        CmsDbContext dbc,
323        CmsOrganizationalUnit parent,
324        boolean includeChildren)
325    throws CmsDataAccessException;
326
327    /**
328     * Returns all resources of the given organizational unit.<p>
329     *
330     * @param dbc the current db context
331     * @param orgUnit the organizational unit to get all resources for
332     *
333     * @return all <code>{@link CmsResource}</code> objects in the organizational unit
334     *
335     * @throws CmsDataAccessException if operation was not successful
336     */
337    List<CmsResource> getResourcesForOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit)
338    throws CmsDataAccessException;
339
340    /**
341     * Returns the SqlManager of this driver.<p>
342     *
343     * @return the SqlManager of this driver
344     */
345    CmsSqlManager getSqlManager();
346
347    /**
348     * Returns all users of the given organizational unit.<p>
349     *
350     * @param dbc the current db context
351     * @param orgUnit the organizational unit to get all users for
352     * @param recursive flag to signalize the retrieval of users of sub-organizational units too
353     *
354     * @return all <code>{@link CmsUser}</code> objects in the organizational unit
355     *
356     * @throws CmsDataAccessException if operation was not successful
357     */
358    List<CmsUser> getUsers(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive)
359    throws CmsDataAccessException;
360
361    /**
362     * Returns all users of the given organizational unit, without reading their additional infos.<p>
363     *
364     * @param dbc the current db context
365     * @param orgUnit the organizational unit to get all users for
366     * @param recursive flag to signalize the retrieval of users of sub-organizational units too
367     *
368     * @return all <code>{@link CmsUser}</code> objects in the organizational unit
369     *
370     * @throws CmsDataAccessException if operation was not successful
371     */
372    List<CmsUser> getUsersWithoutAdditionalInfo(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, boolean recursive)
373    throws CmsDataAccessException;
374
375    //    /**
376    //     * Mark the given resource as visited by the user.<p>
377    //     *
378    //     * @param dbc the database context
379    //     * @param poolName the name of the database pool to use
380    //     * @param resource the resource to mark as visited
381    //     * @param user the user that visited the resource
382    //     *
383    //     * @deprecated
384    //     * @see org.opencms.db.I_CmsSubscriptionDriver
385    //     *
386    //     * @throws CmsDataAccessException if something goes wrong
387    //     */
388    //    void markResourceAsVisitedBy(CmsDbContext dbc, String poolName, CmsResource resource, CmsUser user)
389    //    throws CmsDataAccessException;
390
391    /**
392     * Initializes the SQL manager for this driver.<p>
393     *
394     * To obtain JDBC connections from different pools, further
395     * {online|offline|history} pool Urls have to be specified.<p>
396     *
397     * @param classname the classname of the SQL manager
398     *
399     * @return the SQL manager for this driver
400     */
401    CmsSqlManager initSqlManager(String classname);
402
403    /**
404     * Publish all access control entries of a resource from the given offline project to the online project.<p>
405     *
406     * Within the given project, the resource is identified by its offlineId, in the online project,
407     * it is identified by the given onlineId.<p>
408     *
409     * @param dbc the current database context
410     * @param offlineProject an offline project
411     * @param onlineProject the onlie project
412     * @param offlineId the offline resource id
413     * @param onlineId the online resource id
414     *
415     * @throws CmsDataAccessException if something goes wrong
416     */
417    void publishAccessControlEntries(
418        CmsDbContext dbc,
419        CmsProject offlineProject,
420        CmsProject onlineProject,
421        CmsUUID offlineId,
422        CmsUUID onlineId)
423    throws CmsDataAccessException;
424
425    /**
426     * Reads all relevant access control entries for a given resource.<p>
427     *
428     * @param dbc the current database context
429     * @param project the project to write the entry
430     * @param resource the id of the resource
431     * @param inheritedOnly flag to indicate that only inherited entries should be returned
432     *
433     * @return a list of <code>{@link CmsAccessControlEntry}</code> objects defining all permissions for the given resource
434     *
435     * @throws CmsDataAccessException if something goes wrong
436     */
437    List<CmsAccessControlEntry> readAccessControlEntries(
438        CmsDbContext dbc,
439        CmsProject project,
440        CmsUUID resource,
441        boolean inheritedOnly)
442    throws CmsDataAccessException;
443
444    //    /**
445    //     * Returns all resources subscribed by the given user or group.<p>
446    //     *
447    //     * @param dbc the database context
448    //     * @param poolName the name of the database pool to use
449    //     * @param principal the principal to read the subscribed resources
450    //     *
451    //     * @return all resources subscribed by the given user or group
452    //     *
453    //     * @deprecated
454    //     * @see org.opencms.db.I_CmsSubscriptionDriver
455    //     *
456    //     * @throws CmsDataAccessException if something goes wrong
457    //     */
458    //    List<CmsResource> readAllSubscribedResources(CmsDbContext dbc, String poolName, CmsPrincipal principal)
459    //    throws CmsDataAccessException;
460
461    /**
462     * Reads an access control entry for a given principal that is attached to a resource.<p>
463     *
464     * @param dbc the current database context
465     * @param project the project to write the entry
466     * @param resource the id of the resource
467     * @param principal the id of the principal
468     *
469     * @return an access control entry that defines the permissions of the principal for the given resource
470     *
471     * @throws CmsDataAccessException if something goes wrong
472     */
473    CmsAccessControlEntry readAccessControlEntry(
474        CmsDbContext dbc,
475        CmsProject project,
476        CmsUUID resource,
477        CmsUUID principal)
478    throws CmsDataAccessException;
479
480    /**
481     * Reads all child groups of a group.<p>
482     *
483     * @param dbc the current database context
484     * @param groupFqn the fully qualified name of the group to read the child groups from
485     *
486     * @return a list of all child <code>{@link CmsGroup}</code> objects or <code>null</code>
487     *
488     * @throws CmsDataAccessException if operation was not succesful
489     */
490    List<CmsGroup> readChildGroups(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException;
491
492    /**
493     * Reads a group based on the group id.<p>
494     *
495     * @param dbc the current database context
496     * @param groupId the id of the group that is to be read
497     *
498     * @return the group that was read
499     *
500     * @throws CmsDataAccessException if something goes wrong
501     */
502    CmsGroup readGroup(CmsDbContext dbc, CmsUUID groupId) throws CmsDataAccessException;
503
504    /**
505     * Reads a group based on the group name.<p>
506     *
507     * @param dbc the current database context
508     * @param groupFqn the fully qualified name of the group that is to be read
509     *
510     * @return the group that was read
511     *
512     * @throws CmsDataAccessException if something goes wrong
513     */
514    CmsGroup readGroup(CmsDbContext dbc, String groupFqn) throws CmsDataAccessException;
515
516    /**
517     * Reads all groups the given user is a member in.<p>
518     *
519     * @param dbc the current database context
520     * @param userId the id of the user
521     * @param ouFqn the fully qualified name of the organizational unit to restrict the result set for
522     * @param includeChildOus include groups of child organizational units
523     * @param remoteAddress the IP address to filter the groups in the result list
524     * @param readRoles if to read roles or groups
525     *
526     * @return a list of <code>{@link CmsGroup}</code> objects
527     *
528     * @throws CmsDataAccessException if something goes wrong
529     */
530    List<CmsGroup> readGroupsOfUser(
531        CmsDbContext dbc,
532        CmsUUID userId,
533        String ouFqn,
534        boolean includeChildOus,
535        String remoteAddress,
536        boolean readRoles)
537    throws CmsDataAccessException;
538
539    //    /**
540    //     * Returns the resources that were visited by a user set in the filter.<p>
541    //     *
542    //     * @param dbc the database context
543    //     * @param poolName the name of the database pool to use
544    //     * @param filter the filter that is used to get the visited resources
545    //     *
546    //     * @return the resources that were visited by a user set in the filter
547    //     *
548    //     * @deprecated
549    //     * @see org.opencms.db.I_CmsSubscriptionDriver
550    //     *
551    //     * @throws CmsDataAccessException if something goes wrong
552    //     */
553    //    List<CmsResource> readResourcesVisitedBy(CmsDbContext dbc, String poolName, CmsVisitedByFilter filter)
554    //    throws CmsDataAccessException;
555    //
556    //    /**
557    //     * Returns the subscribed history resources that were deleted.<p>
558    //     *
559    //     * @param dbc the database context
560    //     * @param poolName the name of the database pool to use
561    //     * @param user the user that subscribed to the resource
562    //     * @param groups the groups to check subscribed resources for
563    //     * @param parent the parent resource (folder) of the deleted resources, if <code>null</code> all deleted resources will be returned
564    //     * @param includeSubFolders indicates if the sub folders of the specified folder path should be considered, too
565    //     * @param deletedFrom the time stamp from which the resources should have been deleted
566    //     *
567    //     * @return the subscribed history resources that were deleted
568    //     *
569    //     * @deprecated
570    //     * @see org.opencms.db.I_CmsSubscriptionDriver
571    //     *
572    //     * @throws CmsDataAccessException if something goes wrong
573    //     */
574    //    List<I_CmsHistoryResource> readSubscribedDeletedResources(
575    //        CmsDbContext dbc,
576    //        String poolName,
577    //        CmsUser user,
578    //        List<CmsGroup> groups,
579    //        CmsResource parent,
580    //        boolean includeSubFolders,
581    //        long deletedFrom) throws CmsDataAccessException;
582    //
583    //    /**
584    //     * Returns the resources that were subscribed by a user or group set in the filter.<p>
585    //     *
586    //     * @param dbc the database context
587    //     * @param poolName the name of the database pool to use
588    //     * @param filter the filter that is used to get the subscribed resources
589    //     *
590    //     * @return the resources that were subscribed by a user or group set in the filter
591    //     *
592    //     * @deprecated
593    //     * @see org.opencms.db.I_CmsSubscriptionDriver
594    //     *
595    //     * @throws CmsDataAccessException if something goes wrong
596    //     */
597    //    List<CmsResource> readSubscribedResources(CmsDbContext dbc, String poolName, CmsSubscriptionFilter filter)
598    //    throws CmsDataAccessException;
599
600    /**
601     * Reads an organizational Unit based on its fully qualified name.<p>
602     *
603     * @param dbc the current db context
604     * @param ouFqn the fully qualified name of the organizational Unit to be read
605     *
606     * @return the organizational Unit with the provided fully qualified name
607     *
608     * @throws CmsDataAccessException if something goes wrong
609     */
610    CmsOrganizationalUnit readOrganizationalUnit(CmsDbContext dbc, String ouFqn) throws CmsDataAccessException;
611
612    /**
613     * Reads a user based on the user id.<p>
614     *
615     * @param dbc the current database context
616     * @param id the id of the user to read
617     *
618     * @return the user that was read
619     *
620     * @throws CmsDataAccessException if something goes wrong
621     */
622    CmsUser readUser(CmsDbContext dbc, CmsUUID id) throws CmsDataAccessException;
623
624    /**
625     * Reads a user based in the user fully qualified name.<p>
626     *
627     * @param dbc the current database context
628     * @param userFqn the fully qualified name of the user to read
629     *
630     * @return the user that was read
631     *
632     * @throws CmsDataAccessException if something goes wrong
633     */
634    CmsUser readUser(CmsDbContext dbc, String userFqn) throws CmsDataAccessException;
635
636    /**
637     * Reads a user from the database, only if the password is correct.<p>
638     *
639     * @param dbc the current database context
640     * @param userFqn the name of the user
641     * @param password the password of the user
642     * @param remoteAddress the remote address of the request, may be <code>null</code>
643     *
644     * @return the user that was read
645     *
646     * @throws CmsDataAccessException if something goes wrong
647     * @throws CmsPasswordEncryptionException if the password of the user could not be encrypted
648     */
649    CmsUser readUser(CmsDbContext dbc, String userFqn, String password, String remoteAddress)
650    throws CmsDataAccessException, CmsPasswordEncryptionException;
651
652    /**
653     * Reads the user additional information map.<p>
654     *
655     * @param dbc the current database context
656     * @param userId the id of the user to update
657     *
658     * @return the user additional information map
659     *
660     * @throws CmsDataAccessException if something goes wrong
661     */
662    Map<String, Object> readUserInfos(CmsDbContext dbc, CmsUUID userId) throws CmsDataAccessException;
663
664    /**
665     * Reads all users that are members of the given group.<p>
666     *
667     * @param dbc the current database context
668     * @param groupFqn the fully qualified name of the group to read the users from
669     * @param includeOtherOuUsers include users of other organizational units
670     *
671     * @return all <code>{@link CmsUser}</code> objects in the group
672     *
673     * @throws CmsDataAccessException if something goes wrong
674     */
675    List<CmsUser> readUsersOfGroup(CmsDbContext dbc, String groupFqn, boolean includeOtherOuUsers)
676    throws CmsDataAccessException;
677
678    /**
679     * Removes all access control entries belonging to a resource.<p>
680     *
681     * @param dbc the current database context
682     * @param project the project to write the entry
683     * @param resource the id of the resource
684     *
685     * @throws CmsDataAccessException if something goes wrong
686     */
687    void removeAccessControlEntries(CmsDbContext dbc, CmsProject project, CmsUUID resource)
688    throws CmsDataAccessException;
689
690    /**
691     * Removes all access control entries belonging to a principal.<p>
692     *
693     * @param dbc the current database context
694     * @param project the project to write the entry
695     * @param onlineProject the online project
696     * @param principal the id of the principal
697     *
698     * @throws CmsDataAccessException if something goes wrong
699     */
700    void removeAccessControlEntriesForPrincipal(
701        CmsDbContext dbc,
702        CmsProject project,
703        CmsProject onlineProject,
704        CmsUUID principal)
705    throws CmsDataAccessException;
706
707    /**
708     * Removes an access control entry.<p>
709     *
710     * @param dbc the current database context
711     * @param project the project to write the entry
712     * @param resource the id of the resource
713     * @param principal the id of the principal
714     *
715     * @throws CmsDataAccessException if something goes wrong
716     */
717    void removeAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsUUID resource, CmsUUID principal)
718    throws CmsDataAccessException;
719
720    /**
721     * Removes a resource from the given organizational unit.<p>
722     *
723     * @param dbc the current db context
724     * @param orgUnit the organizational unit to remove the resource from
725     * @param resource the resource that is to be removed from the organizational unit
726     *
727     * @throws CmsDataAccessException if something goes wrong
728     */
729    void removeResourceFromOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsResource resource)
730    throws CmsDataAccessException;
731
732    /**
733     * Searches for users which match the given search criteria.<p>
734     *
735     * @param dbc the database context
736     * @param searchParams the search criteria
737     *
738     * @return the users which match the given criteria
739     *
740     * @throws CmsDataAccessException if something goes wrong
741     */
742    List<CmsUser> searchUsers(CmsDbContext dbc, CmsUserSearchParameters searchParams) throws CmsDataAccessException;
743
744    //    /**
745    //     * Marks a subscribed resource as deleted.<p>
746    //     *
747    //     * @param dbc the database context
748    //     * @param poolName the name of the database pool to use
749    //     * @param resource the subscribed resource to mark as deleted
750    //     *
751    //     * @deprecated
752    //     * @see org.opencms.db.I_CmsSubscriptionDriver
753    //     *
754    //     * @throws CmsDataAccessException if something goes wrong
755    //     */
756    //    void setSubscribedResourceAsDeleted(CmsDbContext dbc, String poolName, CmsResource resource)
757    //    throws CmsDataAccessException;
758
759    /**
760     * Sets the driver manager for this driver if possible.<p>
761     *
762     * @param driverManager the new driver manager
763     */
764    void setDriverManager(CmsDriverManager driverManager);
765
766    //    /**
767    //     * Subscribes the user or group to the resource.<p>
768    //     *
769    //     * @param dbc the database context
770    //     * @param poolName the name of the database pool to use
771    //     * @param principal the principal that subscribes to the resource
772    //     * @param resource the resource to subscribe to
773    //     *
774    //     * @deprecated
775    //     * @see org.opencms.db.I_CmsSubscriptionDriver
776    //     *
777    //     * @throws CmsDataAccessException if something goes wrong
778    //     */
779    //    void subscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource)
780    //    throws CmsDataAccessException;
781    //
782    //    /**
783    //    * Unsubscribes all deleted resources that were deleted before the specified time stamp.<p>
784    //    *
785    //    * @param dbc the database context
786    //    * @param poolName the name of the database pool to use
787    //    * @param deletedTo the time stamp to which the resources have been deleted
788    //    *
789    //    * @deprecated
790    //    * @see org.opencms.db.I_CmsSubscriptionDriver
791    //    *
792    //    * @throws CmsDataAccessException if something goes wrong
793    //    */
794    //    void unsubscribeAllDeletedResources(CmsDbContext dbc, String poolName, long deletedTo)
795    //    throws CmsDataAccessException;
796    //
797    //    /**
798    //     * Unsubscribes the principal from all resources.<p>
799    //     *
800    //     * @param dbc the database context
801    //     * @param poolName the name of the database pool to use
802    //     * @param principal the principal that unsubscribes from all resources
803    //     *
804    //     * @deprecated
805    //     * @see org.opencms.db.I_CmsSubscriptionDriver
806    //     *
807    //     * @throws CmsDataAccessException if something goes wrong
808    //     */
809    //    void unsubscribeAllResourcesFor(CmsDbContext dbc, String poolName, CmsPrincipal principal)
810    //    throws CmsDataAccessException;
811    //
812    //    /**
813    //     * Unsubscribes the principal from the resource.<p>
814    //     *
815    //     * @param dbc the database context
816    //     * @param poolName the name of the database pool to use
817    //     * @param principal the principal that unsubscribes from the resource
818    //     * @param resource the resource to unsubscribe from
819    //     *
820    //     * @deprecated
821    //     * @see org.opencms.db.I_CmsSubscriptionDriver
822    //     *
823    //     * @throws CmsDataAccessException if something goes wrong
824    //     */
825    //    void unsubscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource)
826    //    throws CmsDataAccessException;
827    //
828    //    /**
829    //     * Unsubscribes all groups and users from the resource.<p>
830    //     *
831    //     * @param dbc the database context
832    //     * @param poolName the name of the database pool to use
833    //     * @param resource the resource to unsubscribe all groups and users from
834    //     *
835    //     * @deprecated
836    //     * @see org.opencms.db.I_CmsSubscriptionDriver
837    //     *
838    //     * @throws CmsDataAccessException if something goes wrong
839    //     */
840    //    void unsubscribeResourceForAll(CmsDbContext dbc, String poolName, CmsResource resource)
841    //    throws CmsDataAccessException;
842
843    /**
844     * Sets the SQL manager for this driver if possible.<p>
845     *
846     * @param sqlManager the new SQL manager
847     */
848    void setSqlManager(CmsSqlManager sqlManager);
849
850    /**
851     * Moves an user to the given organizational unit.<p>
852     *
853     * @param dbc the current db context
854     * @param orgUnit the organizational unit to move the user to
855     * @param user the user that is to be moved to the given organizational unit
856     *
857     * @throws CmsDataAccessException if something goes wrong
858     */
859    void setUsersOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit orgUnit, CmsUser user)
860    throws CmsDataAccessException;
861
862    /**
863     * Writes an access control entry.<p>
864     *
865     * @param dbc the current database context
866     * @param project the project to write the entry
867     * @param acEntry the entry to write
868     *
869     * @throws CmsDataAccessException if something goes wrong
870     */
871    void writeAccessControlEntry(CmsDbContext dbc, CmsProject project, CmsAccessControlEntry acEntry)
872    throws CmsDataAccessException;
873
874    /**
875     * Writes an already existing group.<p>
876     *
877     * The group id has to be a valid OpenCms group id.<br>
878     *
879     * The group with the given id will be completely overriden
880     * by the given data.<p>
881     *
882     * @param dbc the current database context
883     * @param group the group to update
884     *
885     * @throws CmsDataAccessException if something goes wrong
886     */
887    void writeGroup(CmsDbContext dbc, CmsGroup group) throws CmsDataAccessException;
888
889    /**
890     * Writes an already existing organizational unit.<p>
891     *
892     * The organizational unit id has to be a valid OpenCms organizational unit id.<br>
893     *
894     * The organizational unit with the given id will be completely overriden
895     * by the given data.<p>
896     *
897     * @param dbc the current db context
898     * @param organizationalUnit the organizational unit that should be written
899     *
900     * @throws CmsDataAccessException if operation was not successful
901     */
902    void writeOrganizationalUnit(CmsDbContext dbc, CmsOrganizationalUnit organizationalUnit)
903    throws CmsDataAccessException;
904
905    /**
906     * Sets a new password for a user.<p>
907     *
908     * @param dbc the current database context
909     * @param userFqn the fullyqualified name of the user to set the password for
910     * @param oldPassword the current password
911     * @param newPassword the password to set
912     *
913     * @throws CmsDataAccessException if something goes wrong
914     * @throws CmsPasswordEncryptionException if the (new) password could not be encrypted
915     */
916    void writePassword(CmsDbContext dbc, String userFqn, String oldPassword, String newPassword)
917    throws CmsDataAccessException, CmsPasswordEncryptionException;
918
919    /**
920     * Updates the user information. <p>
921     *
922     * The user id has to be a valid OpenCms user id.<p>
923     *
924     * The user with the given id will be completely overriden
925     * by the given data.<p>
926     *
927     * @param dbc the current database context
928     * @param user the user to update
929     *
930     * @throws CmsDataAccessException if something goes wrong
931     */
932    void writeUser(CmsDbContext dbc, CmsUser user) throws CmsDataAccessException;
933
934    /**
935     * Writes an user additional information entry.<p>
936     *
937     * @param dbc the current database context
938     * @param userId the id of the user to update
939     * @param key the key of the info to write
940     * @param value the value of the info to write
941     *
942     * @throws CmsDataAccessException if something goes wrong
943     */
944    void writeUserInfo(CmsDbContext dbc, CmsUUID userId, String key, Object value) throws CmsDataAccessException;
945
946}