LDAP User Cleanup - stable7

# Yay, LDAP user cleanup

## How does this stuff work?

1. A background jobs traverses through the mappings table (50 users a time, every 23 minutes, hard coded) and checks whether they are still available in LDAP. If it is not the case, they are marked as "deleted".
2. The LDAP backend now supports "deleting" users. This returns true, when the user name provided represents one of the marked ones.
3. There are two new occ commands that help using this feature:
 1. occ ldap:showRemnants displays a table with all users marked as deleted and details to them
 2. occ user:delete <uid> deletes the given user. If a marked LDAP user is passed hereto, he will be cleaned up.

## What are the restrictions?

The detection (and thus cleanup) will only happen, when those two requirements are fulfilled:
 1. the config.php has an entry "ldapUserCleanupEnabled" set to true
 2. all configured LDAP connections are enabled

The first requirement means that this feature is disabled by default and you actively need to enable it globally. We may change the default in future, when it has been proofed as working really well and does not get in the way.

The second requirement is because this feature cannot be limited to one LDAP configuration. First, because we do not save (only cache) to which server a user belongs. This is because one user theoretically can exists on many servers, while others do not. This is a measure to help against accidental data loss.

## How is the workflow?

1. Use ```./occ ldap:showRemnants``` to see the list of LDAP users marked as deleted:
```
+---------------+----------------+-------------+------------------------------------------------+-------------------------+----------------------------+--------+
| ownCloud name | Display Name   | LDAP UID    | LDAP DN                                        | Last Login              | Dir                        | Sharer |
+---------------+----------------+-------------+------------------------------------------------+-------------------------+----------------------------+--------+
| zombie12839   | May, Arlene    | zombie12839 | uid=zombie12839,ou=zombies,dc=owncloud,dc=bzoc | December  8, 2014 23:03 | /home/openldap/zombie12839 | N      |
| zombie972     | Kennedy, Alice | zombie972   | uid=zombie972,ou=zombies,dc=owncloud,dc=bzoc   | December  8, 2014 23:02 | /home/openldap/zombie972   | N      |
+---------------+----------------+-------------+------------------------------------------------+-------------------------+----------------------------+--------+
```
2. Use ```./occ user:deleted zombie972``` to clean up behind the user. He will vanish from the table also.

What is removed upon cleanup?

* local group assignments (verify) (LDAP groups memberships are dealt with a different background job)
* User preferences (DB table oc_preferences)
* User home folder (local one). Mounts not tested, but it is the same as with local users.
* Corresponding entry in oc_storages
* Apps may decide to clean up they data by listening to delete hooks.

Yes, this command also works on local users resp. any registered backend that implements delete user functionality.

## What is left to do?

* [ ] clean up log messages
* [ ] rename "GarbageCollector" to something more reasonable
* [ ] reevaluate background job interval and batch size
* [ ] rename ldap:showRemnants to be consisten with ldap:show-config etc. maybe with a better name?
please use `show-remnants`

```
Available commands:
  help                        Displays help for a command
  list                        Lists commands
  status                      show some status information
  upgrade                     run upgrade routines
app
  app:disable                 disable an app
  app:enable                  enable an app
  app:list                    List all available apps
db
  db:convert-type             Convert the ownCloud database to the newly configured one
  db:generate-change-script   generates the change script from the current connected db to db_structure.xml
files
  files:scan                  rescan filesystem
ldap
  ldap:search                 executes a user or group search
  ldap:set-config             modifies an LDAP configuration
  ldap:show-config            shows the LDAP configuration
  ldap:showRemnants           shows which users are not available on LDAP anymore, but have remnants in ownCloud.
  ldap:test-config            tests an LDAP configuration
maintenance
  maintenance:mode            set maintenance mode
  maintenance:repair          repair this installation
  maintenance:singleuser      set single user mode
user
  user:delete                 deletes the specified user
  user:lastseen               shows when the user was logged it last time
  user:report                 shows how many users have access
  user:resetpassword          Resets the password of the named user
```