mirror of https://github.com/logos-co/open-law.git
remove useless code
This commit is contained in:
parent
bb685b14fe
commit
6b208a49b6
|
@ -1,21 +0,0 @@
|
||||||
from app import models as m
|
|
||||||
|
|
||||||
BOOK = {
|
|
||||||
"model": m.Book,
|
|
||||||
"entity_id_field": "book_id",
|
|
||||||
}
|
|
||||||
|
|
||||||
COLLECTION = {
|
|
||||||
"model": m.Collection,
|
|
||||||
"entity_id_field": "collection_id",
|
|
||||||
}
|
|
||||||
|
|
||||||
SECTION = {
|
|
||||||
"model": m.Section,
|
|
||||||
"entity_id_field": "section_id",
|
|
||||||
}
|
|
||||||
|
|
||||||
INTERPRETATION = {
|
|
||||||
"model": m.Interpretation,
|
|
||||||
"entity_id_field": "interpretation_id",
|
|
||||||
}
|
|
|
@ -7,51 +7,3 @@ from .book_access_groups import BookAccessGroups
|
||||||
from .collection_access_groups import CollectionAccessGroups
|
from .collection_access_groups import CollectionAccessGroups
|
||||||
from .section_access_groups import SectionAccessGroups
|
from .section_access_groups import SectionAccessGroups
|
||||||
from .interpretation_access_groups import InterpretationAccessGroups
|
from .interpretation_access_groups import InterpretationAccessGroups
|
||||||
|
|
||||||
# access groups
|
|
||||||
# moderators(by default empty) -> root collection -> CRUD Interpretation, Comment
|
|
||||||
# editors(by default empty) -> root collection -> CRUD Collection, Section
|
|
||||||
#
|
|
||||||
# on create collection/section -> inherit parent's access groups
|
|
||||||
#
|
|
||||||
|
|
||||||
# add to collection, sections, ...
|
|
||||||
# - access_groups -> access group table
|
|
||||||
|
|
||||||
# access group:
|
|
||||||
# - name
|
|
||||||
# - users many-to-many = []
|
|
||||||
# - permissions many-to-many = []
|
|
||||||
|
|
||||||
# permission:
|
|
||||||
# - access [Enum(CRUD)]
|
|
||||||
# - entity [Enum(collection, sections, ...)]
|
|
||||||
# - access_group -> access group table
|
|
||||||
|
|
||||||
|
|
||||||
# Book
|
|
||||||
# Version:
|
|
||||||
# Root Collection
|
|
||||||
# Collection A
|
|
||||||
# Section
|
|
||||||
# Section
|
|
||||||
# Collection B
|
|
||||||
# SubCollection B.1
|
|
||||||
# Section
|
|
||||||
# Section
|
|
||||||
# SubCollection B.2
|
|
||||||
# Section
|
|
||||||
# Section
|
|
||||||
|
|
||||||
# If the user has CRUD access to Collection B it means that
|
|
||||||
# it has access to all nested entities(SubCollection B.1/B.2, Sections)
|
|
||||||
|
|
||||||
|
|
||||||
# 1) Create moderator_AG and editor_AG on book create
|
|
||||||
# 2) Inherit parent's access groups
|
|
||||||
|
|
||||||
# TODO many to many
|
|
||||||
# book -> access_group
|
|
||||||
# collections -> access_group
|
|
||||||
# section -> access_group
|
|
||||||
# interpretation -> access_group
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ def set():
|
||||||
flash("User are not contributor of this book!", "danger")
|
flash("User are not contributor of this book!", "danger")
|
||||||
return redirect(url_for("book.my_library"))
|
return redirect(url_for("book.my_library"))
|
||||||
|
|
||||||
|
# TODO process data from checkbox tree
|
||||||
# permissions = json.loads(form.permissions.data)
|
# permissions = json.loads(form.permissions.data)
|
||||||
|
|
||||||
return {"status": "ok"}
|
return {"status": "ok"}
|
||||||
|
|
|
@ -104,12 +104,3 @@ def test_approved_comments(client: FlaskClient):
|
||||||
interpretation.is_deleted = False
|
interpretation.is_deleted = False
|
||||||
interpretation.save()
|
interpretation.save()
|
||||||
assert len(book.approved_comments) == 2
|
assert len(book.approved_comments) == 2
|
||||||
|
|
||||||
collection: m.Collection = m.Collection.query.first()
|
|
||||||
collection.is_deleted = True
|
|
||||||
collection.save()
|
|
||||||
|
|
||||||
interpretation.is_deleted = False
|
|
||||||
interpretation.save()
|
|
||||||
# TODO Fix
|
|
||||||
# assert len(book.approved_comments) == 0
|
|
||||||
|
|
Loading…
Reference in New Issue