tine-groupware / tine

tine groupware main repository
https://www.tine-groupware.de
GNU Affero General Public License v3.0
11 stars 2 forks source link

Is there anyway to mass delete users from a file? (Moved Issue) #14

Closed kiwimarc closed 6 months ago

kiwimarc commented 6 months ago

To see the original issue: https://github.com/tine20/tine20/issues/7481

kiwimarc commented 6 months ago

@pschuele the code changes in the code review don't seem to work as intended:

 try {
    $user = Tinebase_User::getInstance()->getFullUserById($container['owner']);
  } catch (Tinebase_Exception_NotFound) {
    $jsonFrontend->deleteContainers([$container['id']]);
  }

This will show every container because there is no user ID to get from the containers if it's a shared one.

Then It needs to check of account grants or something.

This is what an userless container outputs when printed

Array
(
    [id] => e7bedd31b5de4f0df5c8813d60f544df178ec532
    [name] => test
    [type] => shared
    [color] => #FFFFFF
    [backend] => Sql
    [application_id] => Array
        (
            [id] => 7d761348d3fe90d6dfdadbb6d4bcfbbf5a3df273
            [name] => Tasks
            [status] => enabled
            [order] => 30
            [version] => 15.0
        )

    [content_seq] => 
    [created_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [creation_time] => 2023-11-22 11:57:49
    [last_modified_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [last_modified_time] => 2023-11-22 11:58:15
    [is_deleted] => 0
    [deleted_by] => 
    [deleted_time] => 
    [model] => Tasks_Model_Task
    [seq] => 4
    [uuid] => 
    [order] => 0
    [owner_id] => 
    [xprops] => Array
        (
        )

    [hierarchy] => 
    [path] => /shared/e7bedd31b5de4f0df5c8813d60f544df178ec532
    [account_grants] => Array
        (
            [account_id] => cd7be6c57f6eeab294360097a788a061cf79b576
            [account_type] => user
            [readGrant] => 
            [addGrant] => 
            [editGrant] => 
            [deleteGrant] => 
            [privateGrant] => 
            [exportGrant] => 
            [syncGrant] => 
            [adminGrant] => 
            [freebusyGrant] => 
            [downloadGrant] => 
            [publishGrant] => 
        )

)

This is what a non-userless container outputs:

Array
(
    [id] => eef64b9ad5dea2fdb251bee3af0a54b59368e3f8
    [name] => Test Test 1's personal tasks
    [type] => personal
    [color] => 
    [backend] => Sql
    [application_id] => Array
        (
            [id] => 7d761348d3fe90d6dfdadbb6d4bcfbbf5a3df273
            [name] => Tasks
            [status] => enabled
            [order] => 30
            [version] => 15.0
        )

    [content_seq] => 
    [created_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [creation_time] => 2022-04-19 10:47:04
    [last_modified_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [last_modified_time] => 2022-04-19 10:47:04
    [is_deleted] => 0
    [deleted_by] => 
    [deleted_time] => 
    [model] => Tasks_Model_Task
    [seq] => 2
    [uuid] => 
    [order] => 0
    [owner_id] => 722d91357d8a695a0ca5bd73d2b7fd14f9ad551f
    [xprops] => Array
        (
        )

    [hierarchy] => 
    [path] => /personal/722d91357d8a695a0ca5bd73d2b7fd14f9ad551f/eef64b9ad5dea2fdb251bee3af0a54b59368e3f8
    [account_grants] => Array
        (
            [account_id] => cd7be6c57f6eeab294360097a788a061cf79b576
            [account_type] => user
            [readGrant] => 
            [addGrant] => 
            [editGrant] => 
            [deleteGrant] => 
            [privateGrant] => 
            [exportGrant] => 
            [syncGrant] => 
            [adminGrant] => 
            [freebusyGrant] => 
            [downloadGrant] => 
            [publishGrant] => 
        )

    [ownerContact] => Array
        (
            [id] => 459f7df5210e058100c3ccbd60c14fb87d6260e2
            [adr_one_countryname] => 
            [adr_one_locality] => 
            [adr_one_postalcode] => 
            [adr_one_region] => 
            [adr_one_street] => 
            [adr_one_street2] => 
            [adr_one_lon] => 
            [adr_one_lat] => 
            [adr_two_countryname] => 
            [adr_two_locality] => 
            [adr_two_postalcode] => 
            [adr_two_region] => 
            [adr_two_street] => 
            [adr_two_street2] => 
            [adr_two_lon] => 
            [adr_two_lat] => 
            [cat_id] => 
            [assistent] => 
            [bday] => 
            [calendar_uri] => 
            [email] => test.1@nru.test
            [email_home] => 
            [freebusy_uri] => 
            [geo] => 
            [label] => 
            [note] => 
            [container_id] => 1
            [private] => 0
            [pubkey] => 
            [role] => 
            [room] => 
            [tid] => n
            [salutation] => 
            [title] => 
            [tz] => 
            [url] => 
            [url_home] => 
            [n_family] => Test 1
            [n_fileas] => Test 1, Test
            [n_fn] => Test Test 1
            [n_given] => Test
            [n_middle] => 
            [n_prefix] => 
            [n_suffix] => 
            [org_name] => 
            [org_unit] => 
            [tel_assistent] => 
            [tel_car] => 
            [tel_cell] => 
            [tel_cell_private] => 
            [tel_fax] => 
            [tel_fax_home] => 
            [tel_home] => 
            [tel_other] => 
            [tel_pager] => 
            [tel_prefer] => 
            [tel_work] => 
            [created_by] => cd7be6c57f6eeab294360097a788a061cf79b576
            [creation_time] => 2022-04-19 10:47:00
            [last_modified_by] => 
            [last_modified_time] => 
            [is_deleted] => 0
            [deleted_by] => 
            [deleted_time] => 
            [type] => user
            [seq] => 1
            [tel_assistent_normalized] => 
            [tel_car_normalized] => 
            [tel_cell_normalized] => 
            [tel_cell_private_normalized] => 
            [tel_fax_normalized] => 
            [tel_fax_home_normalized] => 
            [tel_home_normalized] => 
            [tel_other_normalized] => 
            [tel_pager_normalized] => 
            [tel_prefer_normalized] => 
            [tel_work_normalized] => 
            [industry] => 
            [preferred_address] => 0
            [syncBackendIds] => 
            [n_short] => 
            [color] => 
            [language] => 
            [jpegphoto] => 0
            [account_id] => 722d91357d8a695a0ca5bd73d2b7fd14f9ad551f
        )

)
kiwimarc commented 6 months ago

Here is a shared non-userless container:

Array
(
    [id] => 2813f2aacebe39d3f386f5f484a3806598cdb06e
    [name] => Test Empty
    [type] => shared
    [color] => #FFFFFF
    [backend] => Sql
    [application_id] => Array
        (
            [id] => bc36d7f03e44ce42ef3359143e733f5b8803ca4f
            [name] => Calendar
            [status] => enabled
            [order] => 15
            [version] => 15.0
        )

    [content_seq] => 
    [created_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [creation_time] => 2024-01-22 10:57:18
    [last_modified_by] => cd7be6c57f6eeab294360097a788a061cf79b576
    [last_modified_time] => 2024-01-22 10:57:29
    [is_deleted] => 0
    [deleted_by] => 
    [deleted_time] => 
    [model] => Calendar_Model_Event
    [seq] => 4
    [uuid] => 
    [order] => 0
    [owner_id] => 
    [xprops] => Array
        (
        )

    [hierarchy] => 
    [path] => /shared/2813f2aacebe39d3f386f5f484a3806598cdb06e
    [account_grants] => Array
        (
            [account_id] => cd7be6c57f6eeab294360097a788a061cf79b576
            [account_type] => user
            [readGrant] => 1
            [addGrant] => 
            [editGrant] => 
            [deleteGrant] => 
            [privateGrant] => 
            [exportGrant] => 
            [syncGrant] => 
            [adminGrant] => 
            [freebusyGrant] => 
            [downloadGrant] => 
            [publishGrant] => 
        )

)
pschuele commented 6 months ago

hi @kiwimarc , thanks for moving the issue and the PR. I'll review that very soon :+1:

pschuele commented 6 months ago

just merged the PR ... thanks for that