Skip to content

Commit

Permalink
Roll access protocols into vocaburies.json5
Browse files Browse the repository at this point in the history
  • Loading branch information
hatton committed Mar 30, 2024
1 parent af40df3 commit 84bf704
Show file tree
Hide file tree
Showing 17 changed files with 219 additions and 394 deletions.
30 changes: 30 additions & 0 deletions archive-configurations/AILCA/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
accessProtocol: [
{ id: "F", label: "F: Free to All", description: "access is Free to all" },
{
id: "U",
label: "U: All Registered Users",
description: "all Users can access (requires registration)"
},
{
id: "RC",
label: "RC: Registered Users and Community members",
description: "Researchers and Community members are allowed access"
},
{
id: "C",
label: "C: Community members only",
description: "only Community members are allowed access (normally requires application to Depositor)"
},
{
id: "S",
label: "S: Subscribers only",
description: "only Subscribers are allowed access (requires application to Depositor)"
},
{
id: "", // intentionally blank
label: "private", // this label is not official... I just need somethign for the UI
description: "only the Depositor and delegate can access"
}
]
}
8 changes: 8 additions & 0 deletions archive-configurations/AILLA/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
accessProtocol: [
{ id: "Level 1", label: "Level 1", description: "Public Access" },
{ id: "Level 2", label: "Level 2", description: "Password" },
{ id: "Level 3", label: "Level 3", description: "Time limit" },
{ id: "Level 4", label: "Level 4", description: "Depositor control" }
]
}
20 changes: 20 additions & 0 deletions archive-configurations/ANLA/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
accessProtocol: [
{
label: "Level 1",
description: "Public Access",
id: "Level 1"
},
{ label: "Level 2", description: "Password", id: "Level 2", id: "Level 2" },
{
label: "Level 3",
description: "Time limit",
id: "Level 3"
},
{
label: "Level 4",
description: "Depositor control",
id: "Level 4"
}
]
}
6 changes: 3 additions & 3 deletions archive-configurations/ELAR/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
accessProtocol: [
{
key: "O",
id: "O",
label: "O: fully open"
},
{
key: "U",
id: "U",
label: "U: open to users",
description: "All users can access (requires registration)"
},
{
key: "S",
id: "S",
label: "S: open to subscribers",
description: "Only Subscribers are allowed access (must apply to Depositor for access)"
}
Expand Down
14 changes: 14 additions & 0 deletions archive-configurations/PARADISEC/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
accessProtocol: [
{
id: "O",
label: "Open",
description: "Open (subject to PARADISEC access conditions)"
},
{
id: "C",
label: "Closed",
description: "Closed (subject to certain specified conditions)"
}
]
}
6 changes: 3 additions & 3 deletions archive-configurations/REAP/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
accessProtocol: [
{
key: "Public",
id: "Public",
label: "Public",
description: "Open to all users"
},
{
key: "REAP",
id: "REAP",
label: "REAP Users",
description: "Restricted to REAP users"
},
{
key: "Entity",
id: "Entity",
label: "Entity",
description: "Restricted to Organizational Unit"
}
Expand Down
8 changes: 8 additions & 0 deletions archive-configurations/TLA/vocabularies.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
accessProtocol: [
{ label: "Open", description: "Open", id: "Open" },
{ label: "Restricted", description: "Restricted", id: "Restricted" },
{ label: "Protected", description: "Protected", id: "Protected" },
{ label: "Closed", description: "Closed", id: "Closed" }
]
}
2 changes: 1 addition & 1 deletion archive-configurations/lameta/fields.json5
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
form: "ArchiveConfiguration",
"//": "Older Windows SM actually didn't store this in the sprj at all",
xmlTag: "CustomAccessProtocol",
englishLabel: "Custom access choices"
englishLabel: "Custom Session Access Choices"
},
/* Removed at ELAR request Dec 2019, because there is also "contact" and putting your name in 3 times
is a drag.
Expand Down
100 changes: 21 additions & 79 deletions src/ArchiveConfigurationSummary.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import * as React from "react";

import { css } from "@emotion/react";
import {
FieldDefinitionCustomizationRecord,
loadAndMergeFieldChoices
} from "./model/field/ConfiguredFieldDefinitions";
import { FieldDefinition } from "./model/field/FieldDefinition";

import accessProtocols from "./model/Project/AuthorityLists/AccessProtocols/AccessProtocols.json";
import { AuthorityLists } from "./model/Project/AuthorityLists/AuthorityLists";

// a react functional component that takes displays the diffs between the default and the merged configurations
const ArchiveConfigurationSummary: React.FunctionComponent<
{
configurationName: string;
authorityLists: AuthorityLists;
} & React.HTMLAttributes<HTMLDivElement>
> = (props) => {
const [customizations, setCustomizations] = React.useState<
Expand All @@ -34,14 +34,25 @@ const ArchiveConfigurationSummary: React.FunctionComponent<
);
return (
<div>
<h2>Access Protocols</h2>
<ul>
{accessProtocols
.find((p) => p.protocol == props.configurationName)!
<h2>Session Access Choices</h2>
<ul
css={css`
li {
margin-bottom: 1em;
// don't show a bullet point
list-style-type: none;
}
`}
>
{props.authorityLists.accessProtocolLists
.find((p) => p.archiveConfigurationName == props.configurationName)!
.choices.map((choice) => (
<div key={choice.label}>
<b>{choice.label}</b> {choice.description}
</div>
<li key={choice.label}>
<div>
<b>{choice.label}</b>
</div>
{choice.description}
</li>
))}
</ul>
<h2>Field Changes</h2>
Expand Down Expand Up @@ -142,72 +153,3 @@ function describeChange(
</React.Fragment>
);
}
/*
// look at every field in the customization and see if it is different from the factory definition
// for each difference, add an entry to the diffs array
for (const key of Object.keys(entry)) {
if (entry[key] !== factoryDefinition[key]) {
// if factoryDefinition.visibility undefined or "never" and entry changes it to always, that's an "addition"
if (
factoryDefinition.visibility === "never" &&
entry.visibility === "always"
) {
diffs.push({
factoryDefinition,
area,
change: "addition",
message: `addded ${key}`
});
}
// if factoryDefinition.visibility is "always" and entry changes it to "never", that's a "removal"
else if (
factoryDefinition.visibility !== "never" &&
entry.visibility === "never"
) {
diffs.push({
area,
factoryDefinition,
change: "removal",
message: `removed ${key}`
});
} else {
diffs.push({
area,
factoryDefinition,
change: "other",
message: `${area} ${factoryDefinition.englishLabel} changed from ${factoryDefinition[key]} to ${entry[key]}`
});
}
}
}
*/

/*
<ul>
{diffs
.filter((diff) => diff.change === "addition")
.map((diff) => (
<li key={diff.area + diff.factoryDefinition.key}>
{diff.area} {diff.factoryDefinition.englishLabel}
</li>
))}
</ul>
<h4>Removals</h4>
<ul>
{diffs
.filter((diff) => diff.change === "removal")
.map((diff) => (
<li key={diff.factoryDefinition.key}>
{diff.factoryDefinition.englishLabel}
</li>
))}
</ul>
<h4>Other</h4>
<ul>
{diffs
.filter((diff) => diff.change === "other")
.map((diff) => (
<li key={diff.factoryDefinition.key}>{diff.message}</li>
))}
</ul>
*/
16 changes: 0 additions & 16 deletions src/components/project/AccessProtocolForm.scss

This file was deleted.

Loading

0 comments on commit 84bf704

Please sign in to comment.