diff --git a/arches_lingo/serializers.py b/arches_lingo/serializers.py index 95ca4f07..4091b03b 100644 --- a/arches_lingo/serializers.py +++ b/arches_lingo/serializers.py @@ -33,6 +33,12 @@ class Meta: nodegroups = ["creation"] fields = "__all__" +class SchemeRightsSerializer(ArchesModelSerializer): + class Meta: + model = ResourceInstance + graph_slug = "scheme" + nodegroups = ["rights"] + fields = "__all__" class TextualWorkRdmSystemSerializer(ArchesModelSerializer): class Meta: @@ -42,6 +48,22 @@ class Meta: fields = "__all__" +class GroupRdmSystemSerializer(ArchesModelSerializer): + class Meta: + model = ResourceInstance + graph_slug = "group" + nodegroups = "__all__" + fields = "__all__" + + +class PersonRdmSystemSerializer(ArchesModelSerializer): + class Meta: + model = ResourceInstance + graph_slug = "person" + nodegroups = "__all__" + fields = "__all__" + + class ConceptStatementSerializer(ArchesTileSerializer): class Meta: model = TileModel diff --git a/arches_lingo/src/arches_lingo/api.ts b/arches_lingo/src/arches_lingo/api.ts index 318dfcb3..90a74608 100644 --- a/arches_lingo/src/arches_lingo/api.ts +++ b/arches_lingo/src/arches_lingo/api.ts @@ -52,6 +52,20 @@ export const fetchTextualWorkRdmSystemList = async () => { return parsed; }; +export const fetchPersonRdmSystemList = async () => { + const response = await fetch(arches.urls.api_person_list); + const parsed = await response.json(); + if (!response.ok) throw new Error(parsed.message || response.statusText); + return parsed; +}; + +export const fetchGroupRdmSystemList = async () => { + const response = await fetch(arches.urls.api_group_list); + const parsed = await response.json(); + if (!response.ok) throw new Error(parsed.message || response.statusText); + return parsed; +}; + export const fetchSchemeCreation = async (schemeId: string) => { const response = await fetch(arches.urls.api_scheme_creation(schemeId)); const parsed = await response.json(); @@ -59,6 +73,13 @@ export const fetchSchemeCreation = async (schemeId: string) => { return parsed; }; +export const fetchSchemeRights = async (schemeId: string) => { + const response = await fetch(arches.urls.api_scheme_rights(schemeId)); + const parsed = await response.json(); + if (!response.ok) throw new Error(parsed.message || response.statusText); + return parsed; +}; + export const updateSchemeCreation = async ( schemeId: string, schemeInstance: SchemeInstance, @@ -93,6 +114,24 @@ export const updateSchemeNamespace = async ( return parsed; }; +export const updateSchemeRights = async ( + schemeId: string, + schemeRights: SchemeInstance, +) => { + const response = await fetch(arches.urls.api_scheme_rights(schemeId), { + method: "PATCH", + headers: { + "X-CSRFTOKEN": getToken(), + "Content-Type": "application/json", + }, + body: JSON.stringify(schemeRights), + }); + const parsed = await response.json(); + console.log(parsed); + if (!response.ok) throw new Error(parsed.message || response.statusText); + return parsed; +}; + export const fetchSearchResults = async ( searchTerm: string, items: number, diff --git a/arches_lingo/src/arches_lingo/components/scheme/editor/SchemeEditor.vue b/arches_lingo/src/arches_lingo/components/scheme/editor/SchemeEditor.vue index 11ca725a..25949435 100644 --- a/arches_lingo/src/arches_lingo/components/scheme/editor/SchemeEditor.vue +++ b/arches_lingo/src/arches_lingo/components/scheme/editor/SchemeEditor.vue @@ -10,6 +10,7 @@ import TabPanel from "primevue/tabpanel"; import SchemeNamespace from "../report/SchemeNamespace.vue"; import { onBeforeUpdate, onUpdated, ref } from "vue"; import SchemeStandard from "../report/SchemeStandard.vue"; +import SchemeLicense from "../report/SchemeLicense.vue"; type sectionTypes = typeof SchemeNamespace; const { $gettext } = useGettext(); @@ -30,6 +31,11 @@ const schemeComponents = [ id: "standard", editorTabName: $gettext("Scheme Standards Followed"), }, + { + component: SchemeLicense, + id: "rights", + editorTabName: $gettext("Scheme Rights"), + }, ]; const emit = defineEmits(["maximize", "side", "close", "updated"]); diff --git a/arches_lingo/src/arches_lingo/components/scheme/report/SchemeLicense.vue b/arches_lingo/src/arches_lingo/components/scheme/report/SchemeLicense.vue index 90ba3748..fd93c97f 100644 --- a/arches_lingo/src/arches_lingo/components/scheme/report/SchemeLicense.vue +++ b/arches_lingo/src/arches_lingo/components/scheme/report/SchemeLicense.vue @@ -1,11 +1,96 @@ diff --git a/arches_lingo/src/arches_lingo/types.ts b/arches_lingo/src/arches_lingo/types.ts index 6e7f751c..67d3fef8 100644 --- a/arches_lingo/src/arches_lingo/types.ts +++ b/arches_lingo/src/arches_lingo/types.ts @@ -80,6 +80,9 @@ export interface SchemeInstance { creation?: { creation_sources: ResourceInstanceReference[]; }; + rights?: { + right_holder: ResourceInstanceReference[]; + }; } export interface SchemeResource { diff --git a/arches_lingo/templates/arches_urls.htm b/arches_lingo/templates/arches_urls.htm index cbca5c15..e588bb33 100644 --- a/arches_lingo/templates/arches_urls.htm +++ b/arches_lingo/templates/arches_urls.htm @@ -13,5 +13,8 @@ api_schemes="{% url 'schemes-list-create' %}" api_scheme_creation='(pluginid)=>{return "{% url "api-scheme-creation" "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" %}".replace("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", pluginid)}' api_textualwork_list="{% url 'api-textualwork-list' %}" + api_person_list="{% url 'api-person-list' %}" + api_group_list="{% url 'api-group-list' %}" + api_scheme_rights='(pluginid)=>{return "{% url "api-scheme-rights" "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" %}".replace("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", pluginid)}' > {% endblock arches_urls %} diff --git a/arches_lingo/urls.py b/arches_lingo/urls.py index 2f7f96d4..5a7ee723 100644 --- a/arches_lingo/urls.py +++ b/arches_lingo/urls.py @@ -11,12 +11,15 @@ ConceptStatementDetailView, ConceptStatementListCreateView, SchemeCreationView, + SchemeRightsView, SchemeDetailView, SchemeListCreateView, SchemeNamespaceView, SchemeStatementDetailView, SchemeStatementListCreateView, TextualWorkRdmSystemSerializerView, + PersonRdmSystemSerializerView, + GroupRdmSystemSerializerView, ) urlpatterns = [ @@ -53,11 +56,26 @@ SchemeCreationView.as_view(), name="api-scheme-creation", ), + path( + "api/scheme//scheme-rights", + SchemeRightsView.as_view(), + name="api-scheme-rights", + ), path( "api/textual-work", TextualWorkRdmSystemSerializerView.as_view(), name="api-textualwork-list", ), + path( + "api/person", + PersonRdmSystemSerializerView.as_view(), + name="api-person-list", + ), + path( + "api/group", + GroupRdmSystemSerializerView.as_view(), + name="api-group-list", + ), path( "api/scheme/statements", SchemeStatementListCreateView.as_view(), diff --git a/arches_lingo/views/api/pythonic_models.py b/arches_lingo/views/api/pythonic_models.py index 7567d942..65164b80 100644 --- a/arches_lingo/views/api/pythonic_models.py +++ b/arches_lingo/views/api/pythonic_models.py @@ -12,9 +12,12 @@ SchemeCreationSerializer, SchemeNamespaceSerializer, SchemeSerializer, + SchemeRightsSerializer, ConceptStatementSerializer, SchemeStatementSerializer, TextualWorkRdmSystemSerializer, + GroupRdmSystemSerializer, + PersonRdmSystemSerializer, ) @@ -54,11 +57,27 @@ class SchemeCreationView(ArchesModelAPIMixin, RetrieveUpdateDestroyAPIView): serializer_class = SchemeCreationSerializer +class SchemeRightsView(ArchesModelAPIMixin, RetrieveUpdateDestroyAPIView): + permission_classes = [RDMAdministrator] + serializer_class = SchemeRightsSerializer + + class TextualWorkRdmSystemSerializerView(ArchesModelAPIMixin, ListAPIView): permission_classes = [RDMAdministrator] serializer_class = TextualWorkRdmSystemSerializer pagination_class = None +class GroupRdmSystemSerializerView(ArchesModelAPIMixin, ListAPIView): + permission_classes = [RDMAdministrator] + serializer_class = GroupRdmSystemSerializer + pagination_class = None + + +class PersonRdmSystemSerializerView(ArchesModelAPIMixin, ListAPIView): + permission_classes = [RDMAdministrator] + serializer_class = PersonRdmSystemSerializer + pagination_class = None + class ConceptDetailView(ArchesModelAPIMixin, RetrieveUpdateDestroyAPIView): permission_classes = [RDMAdministrator]