示例#1
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));
   }
 }
示例#2
0
 public static Group getGroup(String name) {
   for (Group group : groups) {
     if (group.getName().equalsIgnoreCase(name)) {
       return group;
     }
   }
   return null;
 }
示例#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);
  }