From 8f523285916a21e31c2b695dfd0512f4f3c18e1d Mon Sep 17 00:00:00 2001 From: stefanp Date: Wed, 5 Jun 2002 13:13:56 +0000 Subject: [PATCH] added app.getRegisteredUsers() --- src/helma/framework/core/Application.java | 22 +++++++++++++++++++ src/helma/framework/core/ApplicationBean.java | 5 +++++ 2 files changed, 27 insertions(+) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index d7c31964..3356377b 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -646,6 +646,28 @@ public class Application extends UnicastRemoteObject implements IRemoteApp, IPat return list; } + + /** + * Return a list of Helma nodes (HopObjects - the database object representing the user, + * not the session object) representing registered users of this application. + */ + public List getRegisteredUsers () { + ArrayList list = new ArrayList (); + INode users = getUserRoot (); + // first try to get them from subnodes (db) + for (Enumeration e=users.getSubnodes(); e.hasMoreElements(); ) { + list.add ((INode)e.nextElement ()); + } + // if none, try to get them from properties (internal db) + if (list.size()==0) { + for (Enumeration e=users.properties(); e.hasMoreElements(); ) { + list.add (users.getNode ((String)e.nextElement (),false)); + } + } + return list; + } + + /** * Return an array of SessionBean objects currently associated with a given * Helma user. diff --git a/src/helma/framework/core/ApplicationBean.java b/src/helma/framework/core/ApplicationBean.java index 99b28fac..bfa93832 100644 --- a/src/helma/framework/core/ApplicationBean.java +++ b/src/helma/framework/core/ApplicationBean.java @@ -93,6 +93,11 @@ public class ApplicationBean implements Serializable { return (INode[]) activeUsers.toArray (new INode[0]); } + public INode[] getRegisteredUsers () { + List registeredUsers = app.getRegisteredUsers (); + return (INode[]) registeredUsers.toArray (new INode[0]); + } + public SessionBean[] getSessionsForUser (INode usernode) { if (usernode==null) return new SessionBean[0];