Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build docker image
name: Docker

on:
workflow_dispatch:
Expand All @@ -13,9 +13,7 @@ on:

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
# See https://github.com/atomicdata-dev/atomic-data-rust/issues/499
# if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
name: Build Docker images and push to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
Expand Down Expand Up @@ -43,10 +41,11 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
provenance: false
platforms: linux/amd64,linux/arm64
tags: joepmeneer/atomic-server:latest
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
on: [push, workflow_dispatch]

name: "Build, test, clippy"
jobs:
check:
name: Check
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain
- Add `POST` + `body` support for Endpoints #592
- Refactor `Endpoint` handlers, uses a Context now #592
- Re-build store + invite when adjusting server url #607
- Use local atomic-server for properties and classes, improves atomic-server #604

## [v0.34.1] - 2023-02-11

Expand Down
5 changes: 3 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM rust as builder
FROM rust:1.67 as builder
WORKDIR /app
COPY . .
RUN cargo build --release --bin atomic-server
RUN cargo build --release --bin atomic-server --config net.git-fetch-with-cli=true

# We only need a small runtime for this step, but make sure glibc is installed
FROM frolvlad/alpine-glibc:alpine-3.16_glibc-2.34 as runtime
COPY --chmod=0755 --from=builder /app/target/release/atomic-server /atomic-server-bin
# For a complete list of possible ENV vars or available flags, run with `--help`
ENV ATOMIC_STORE_PATH="/atomic-storage/db"
ENV ATOMIC_CONFIG_PATH="/atomic-storage/config.toml"
ENV ATOMIC_PORT="80"
Expand Down
43 changes: 22 additions & 21 deletions lib/src/hierarchy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use core::fmt;

use crate::{errors::AtomicResult, storelike::Query, urls, AtomicError, Resource, Storelike};
use crate::{errors::AtomicResult, storelike::Query, urls, Resource, Storelike};

#[derive(Debug)]
pub enum Right {
Expand Down Expand Up @@ -64,32 +64,33 @@ pub fn check_read(
/// This checks the `append` rights, and if that fails, checks the `write` right.
/// Throws if not allowed.
/// Returns string with explanation if allowed.
#[tracing::instrument(skip(store), level = "debug")]
pub fn check_append(
store: &impl Storelike,
resource: &Resource,
for_agent: &str,
) -> AtomicResult<String> {
let parent = if let Ok(parent) = resource.get_parent(store) {
parent
} else {
if resource
.get_classes(store)?
.iter()
.map(|c| c.subject.clone())
.collect::<String>()
.contains(urls::DRIVE)
{
return Ok(String::from("Drive without a parent can be created"));
match resource.get_parent(store) {
Ok(parent) => {
if let Ok(msg) = check_rights(store, &parent, for_agent, Right::Append) {
Ok(msg)
} else {
check_rights(store, resource, for_agent, Right::Write)
}
}
Err(e) => {
if resource
.get_classes(store)?
.iter()
.map(|c| c.subject.clone())
.collect::<String>()
.contains(urls::DRIVE)
{
Ok(String::from("Drive without a parent can be created"))
} else {
Err(e)
}
}
return Err(AtomicError::unauthorized(format!(
"No parent found for {}",
resource.get_subject()
)));
};
if let Ok(msg) = check_rights(store, &parent, for_agent, Right::Append) {
Ok(msg)
} else {
check_rights(store, resource, for_agent, Right::Write)
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/populate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub fn populate_default_store(store: &impl Storelike) -> AtomicResult<()> {
Ok(())
}

/// Generates some nice collections for classes, such as `/agent` and `/collection`.
/// Generates collections for classes, such as `/agent` and `/collection`.
/// Requires a `self_url` to be set in the store.
pub fn populate_collections(store: &impl Storelike) -> AtomicResult<()> {
let mut query = Query::new_class(urls::CLASS);
Expand Down
238 changes: 119 additions & 119 deletions server/app_assets/assets/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/app_assets/assets/index.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions server/app_assets/assets/index2.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading