require 'rm/plugins/agendav'
class AgendavPrune < AgendavRm
-
include PrunePlugin
-
- def get_leftover_domains(db_domains)
- # AgenDAV doesn't have a concept of domains. We could parse the
- # usernames to see what domains are present, but the point is
- # moot: all leftover users will be pruned anyway.
- return []
- end
-
-
- def get_leftover_users(db_users)
- # Get a list of all users who have logged in to AgenDAV.
- ad_users = self.list_users()
- return ad_users - db_users
- end
-
end
require 'rm/plugins/davical'
class DavicalPrune < DavicalRm
- #
- # DAViCal only supports Postgres, so even if we ever are
- # database-agnostic, this plugin can't be.
- #
include PrunePlugin
-
-
- def get_leftover_domains(db_domains)
- # DAViCal doesn't have a concept of domains. We could parse the
- # usernames to see what domains are present, but the point is
- # moot: all leftover users will be pruned anyway.
- return []
- end
-
-
- def get_leftover_users(db_users)
- # Get a list of all users who have logged in to DAViCal.
- davical_users = self.list_users()
- return davical_users - db_users
- end
-
-
end
require 'rm/plugins/dovecot'
class DovecotPrune < DovecotRm
-
include PrunePlugin
-
-
- def get_leftover_domains(db_domains)
- # Get the list of domains according to the filesystem.
- fs_domains = self.list_domains()
-
- # Return the list of domains on the filesystem that aren't in the DB.
- return (fs_domains - db_domains)
- end
-
- def get_leftover_users(db_users)
- # Get the list of users according to the filesystem.
- fs_domains = self.list_domains()
- fs_users = self.list_domains_users(fs_domains)
-
- # And return the users on the filesystem that aren't in the DB.
- return (fs_users - db_users)
- end
-
end
require 'rm/plugins/roundcube'
class RoundcubePrune < RoundcubeRm
-
include PrunePlugin
-
-
- def get_leftover_domains(db_domains)
- # Roundcube doesn't have a concept of domains. We could parse the
- # usernames to see what domains are present, but the point is
- # moot: all leftover users will be pruned anyway.
- return []
- end
-
-
- def get_leftover_users(db_users)
- # Get a list of all users who have logged in to Roundcube.
- rc_users = self.list_users()
- return rc_users - db_users
- end
-
end
def get_leftover_domains(db_domains)
# Given a list of domains, determine which domains belonging to
# this plugin are not contained in the given list.
- raise NotImplementedError
+
+ # WARNING! Array difference doesn't work for some reason.
+ return list_domains().select{ |d| !db_domains.include?(d) }
end
def get_leftover_users(db_users)
# Given a list of users, determine which users belonging to
# this plugin are not contained in the given list.
- raise NotImplementedError
+
+ # WARNING! Array difference doesn't work for some reason.
+ return list_users().select{ |u| !db_users.include?(u) }
end
end