MCPcopy Create free account
hub / github.com/BaseXdb/basex / users

Method users

basex-core/src/main/java/org/basex/core/users/Users.java:198–213  ·  view source on GitHub ↗

Returns all users, or users that have permissions for a specific database. The list will only contain the current user if no admin permissions are available. @param db database (can be null) @param ctx database context @return user information

(final String db, final Context ctx)

Source from the content-addressed store, hash-verified

196 * @return user information
197 */
198 public synchronized ArrayList<User> users(final String db, final Context ctx) {
199 final User curr = ctx.user();
200 final boolean admin = curr.has(Perm.ADMIN);
201 final ArrayList<User> list = new ArrayList<>();
202 for(final User user : users.values()) {
203 if(admin || curr == user) {
204 if(db == null) {
205 list.add(user);
206 } else {
207 final Entry<String, Perm> entry = user.find(db);
208 if(entry != null) list.add(user);
209 }
210 }
211 }
212 return list;
213 }
214
215 /**
216 * Returns the info element.

Callers 3

infoMethod · 0.95
valueMethod · 0.80
valueMethod · 0.80

Calls 5

hasMethod · 0.95
addMethod · 0.65
userMethod · 0.45
valuesMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected