- def get_leftover_accounts(db_accounts)
- # Given a list of accounts, determine which accounts belonging to
- # this plugin are not contained in the given list.
- raise NotImplementedError
+
+ # Determine which users are "left over" for this plugin. A user
+ # is considered "left over" if it has been removed from Postfixadmin
+ # but not some other plugin.
+ #
+ # The leftovers are determined with respect to the list *db_users*
+ # of users that Postfixadmin knows about.
+ #
+ # @param db_users [Array<User>] a list of users that are present
+ # in the Postfixadmin database.
+ #
+ # @return [Array<User>] a list of users known to this plugin but
+ # not to Postfixadmin.
+ #
+ def get_leftover_users(db_users)
+ # WARNING! Array difference doesn't work for some reason.
+ return list_users().select{ |u| !db_users.include?(u) }