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