require 'common/plugin'
+require 'common/user'
module AgendavPlugin
# Code that all Agendav plugins (Prune, Rm, Mv...) will
end
- def describe_domain(domain)
- # AgenDAV doesn't have a concept of domains.
- return domain
- end
-
-
- def describe_user(user)
- if self.user_exists(user)
- return "Username: #{user}"
- else
- return 'User not found'
- end
- end
-
-
- protected;
-
-
def list_users()
- usernames = []
+ #
+ # Produce a list of AgenDAV users. This is public because it's
+ # useful in testing.
+ #
+ users = []
# Just assume PostgreSQL for now.
begin
sql_query += '(SELECT user_from FROM shared);'
connection.query(sql_query) do |result|
- usernames = result.field_values('username')
+ users = result.field_values('username')
end
connection.close()
raise DatabaseError.new(e)
end
- return usernames
+ return users.map{ |u| User.new(u) }
end
end