Example #1
0
 public static Group getGroup(String name) {
   for (Group group : groups) {
     if (group.getName().equalsIgnoreCase(name)) {
       return group;
     }
   }
   return null;
 }
Example #2
0
 public static void saveGroups() {
   MongoCollection<Document> collection = MongoConnection.getCollection("perms", "groups");
   for (Group group : groups) {
     collection.replaceOne(
         eq("group", group.getName()),
         new Document("group", group.getName())
             .append("permissions", group.permissions)
             .append("inherits", group.inherits));
   }
 }
Example #3
0
  public void removeInheritance(Group group) {
    inherits.remove(group.getName());

    MongoCollection<Document> collection = MongoConnection.getCollection("perms", "groups");
    Document doc = collection.find(eq("group", name)).first();
    doc.put("inherits", inherits);
    collection.replaceOne(eq("group", name), doc);
  }