Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lorawoodford committed Dec 27, 2024
0 parents commit 14a01fd
Show file tree
Hide file tree
Showing 5 changed files with 236 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] "
labels: bug
assignees: lorawoodford

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

_Optional, but include if helpful/relevant_
**Desktop:**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone/Mobile:**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[FEATURE]"
labels: enhancement
assignees: lorawoodford

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
23 changes: 23 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Description
<!--- Describe your changes. Why is this required? What problem does it solve? What functionality does it extend? -->

## Related GitHub Issue
<!--- Please link to GitHub Issue here: -->

## Testing
<!--- Please describe, in detail, how you tested your changes. -->

## Screenshot(s):
<!--- Optional screenshots of changes if relevant and helpful to reviewers -->

## Checklist

- [ ] ✔️ Have you assigned at least one reviewer?
- [ ] 🔗 Have you referenced any issues this PR will close?
- [ ] ⬇️ Have you merged the latest upstream changes into your branch?
- [ ] 🧪 Have you added tests to cover these changes? If not, why:

- [ ] 🤖 Have automated checks (if any) passed? If not, please explain for the reviewer:

- [ ] 📘 Have you updated/added any relevant readmes/comments in the codebase?
- [ ] 📚 Have you updated/added any external documentation (e.g. Confluence)?
69 changes: 69 additions & 0 deletions .github/workflows/diff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Diff after_create method

on:
pull_request:
branches:
- main
paths:
- 'backend/model/**'

jobs:
diff:
runs-on: ubuntu-latest
env:
PROD_ARCHIVESSPACE_VERSION: v3.3.1
continue-on-error: true
strategy:
matrix:
archivesspace_version: [v3.3.1, v3.4.1, v3.5.1]
steps:

- name: Checkout current plugin
uses: actions/checkout@v4
with:
path: plugin
sparse-checkout: |
backend/model
- name: Checkout ArchivesSpace baseline repo
uses: actions/checkout@v4
with:
ref: ${{ env.PROD_ARCHIVESSPACE_VERSION }}
repository: Smithsonian/archivesspace
path: archivesspace-baseline
sparse-checkout: |
backend/app/model
- name: Checkout ArchivesSpace repo
uses: actions/checkout@v4
with:
ref: ${{ matrix.archivesspace_version }}
repository: Smithsonian/archivesspace
path: archivesspace
sparse-checkout: |
backend/app/model
- name: Diff with baseline
id: baseline
run: |
echo "baseline_changes=$(git diff --diff-filter=M --shortstat ${{ github.workspace }}/archivesspace-baseline/backend/app/model ${{ github.workspace }}/plugin/backend/model)" > $GITHUB_OUTPUT
- name: Diff with new versions
id: new
run: |
echo "new_changes=$(git diff --diff-filter=M --shortstat ${{ github.workspace }}/archivesspace/backend/app/model ${{ github.workspace }}/plugin/backend/model)" > $GITHUB_OUTPUT
- name: Diffs match
if: ${{ steps.baseline.outputs.baseline_changes == steps.new.outputs.new_changes }}
run: |
echo "${{ steps.baseline.outputs.baseline_changes }}"
echo "${{ steps.new.outputs.new_changes }}"
echo "${{ steps.new.outputs.new_changes2 }}"
echo "All models overridden by this plugin match $PROD_ARCHIVESSPACE_VERSION of ArchivesSpace"
- name: Diffs do not match
if: ${{ steps.baseline.outputs.baseline_changes != steps.new.outputs.new_changes }}
run: |
echo "Some models overridden by this plugin do not match those in ArchivesSpace ${{ matrix.archivesspace_version }}. See:"
echo "::set-output name=review_changes::$(git diff --diff-filter=M -w --color -- ${{ github.workspace }}/archivesspace/backend/app/model ${{ github.workspace }}/plugin/backend/model)"
exit 1
85 changes: 85 additions & 0 deletions backend/model/repository.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
class Repository
# SI over-ride to ensure new repos are created with the set of permissions we explicitly want
def after_create
if self.repo_code == Repository.GLOBAL
# No need for standard groups on this one.
return
end

standard_groups = [{
:group_code => "repository-managers",
:description => I18n.t("group.default_group_names.repository_managers", :repo_code => repo_code),
:grants_permissions => ["manage_repository", "update_location_record", "update_subject_record",
"update_agent_record", "update_accession_record", "update_resource_record",
"update_digital_object_record", "update_event_record", "delete_event_record", "update_container_record",
"update_container_profile_record", "update_location_profile_record",
"view_repository", "delete_archival_record", "suppress_archival_record",
"manage_subject_record", "manage_agent_record", "view_agent_contact_record", "manage_vocabulary_record",
"manage_rde_templates", "manage_container_record", "manage_container_profile_record",
"manage_location_profile_record", "import_records", "cancel_job",
"update_assessment_record", "delete_assessment_record", "manage_assessment_attributes",
"update_enumeration_record", "manage_enumeration_record",
"show_full_agents", "manage_custom_report_templates"]
},
{
:group_code => "repository-archivists",
:description => I18n.t("group.default_group_names.repository_archivists", :repo_code => repo_code),
:grants_permissions => ["update_subject_record", "update_agent_record", "update_accession_record",
"update_resource_record", "update_digital_object_record", "update_event_record",
"update_container_record", "update_container_profile_record",
"update_location_profile_record", "view_repository", "manage_subject_record",
"manage_agent_record", "view_agent_contact_record", "manage_vocabulary_record", "manage_container_record",
"manage_container_profile_record", "manage_location_profile_record", "import_records",
"update_assessment_record", "delete_assessment_record", "create_job", "cancel_job",
"update_enumeration_record", "manage_enumeration_record",
"show_full_agents", "manage_custom_report_templates"]
},
{
:group_code => "repository-project-managers",
:description => I18n.t("group.default_group_names.project_managers", :repo_code => repo_code),
:grants_permissions => ["view_repository", "update_accession_record", "update_resource_record",
"update_digital_object_record", "update_event_record", "delete_event_record", "update_subject_record",
"update_agent_record", "update_container_record",
"update_container_profile_record", "update_location_profile_record",
"delete_archival_record", "suppress_archival_record",
"manage_subject_record", "manage_agent_record", "view_agent_contact_record", "manage_vocabulary_record",
"manage_container_record", "manage_container_profile_record",
"manage_location_profile_record", "import_records", 'merge_agents_and_subjects',
"update_assessment_record", "delete_assessment_record", "update_enumeration_record",
"manage_enumeration_record"]
},
{
:group_code => "repository-advanced-data-entry",
:description => I18n.t("group.default_group_names.advanced_data_entry", :repo_code => repo_code),
:grants_permissions => ["view_repository", "update_accession_record", "update_resource_record",
"update_digital_object_record", "update_event_record", "update_subject_record",
"update_agent_record", "update_container_record",
"update_container_profile_record", "update_location_profile_record",
"manage_subject_record", "manage_agent_record",
"manage_vocabulary_record", "manage_container_record",
"manage_container_profile_record", "manage_location_profile_record",
"import_records", "update_assessment_record", "delete_assessment_record",
"update_enumeration_record", "manage_enumeration_record"]
},
{
:group_code => "repository-basic-data-entry",
:description => I18n.t("group.default_group_names.basic_data_entry", :repo_code => repo_code),
:grants_permissions => ["view_repository", "update_accession_record", "update_resource_record",
"update_digital_object_record", "create_job"]
},
{
:group_code => "repository-viewers",
:description => I18n.t("group.default_group_names.repository_viewers", :repo_code => repo_code),
:grants_permissions => ["view_repository", "create_job"]
}]

RequestContext.open(:repo_id => self.id) do
standard_groups.each do |group_data|
Group.create_from_json(JSONModel(:group).from_hash(group_data),
:repo_id => self.id)
end
end

Notifications.notify("REPOSITORY_CHANGED")
end
end

0 comments on commit 14a01fd

Please sign in to comment.