Compare commits
3 Commits
b55139eb1c
...
782e197d91
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
782e197d91 | ||
|
|
020759bfb3 | ||
|
|
85f50bfc96 |
56
.github/workflows/build.yml
vendored
Normal file
56
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Build and publish image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
tags: [ 'v*' ]
|
||||
|
||||
# Only one build per ref at a time; cancel superseded main builds.
|
||||
concurrency:
|
||||
group: build-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.ref == 'refs/heads/main' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write # Required to push to GHCR
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract image metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=edge,branch=main
|
||||
type=sha,prefix=sha-,format=short,enable={{is_default_branch}}
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
flavor: |
|
||||
latest=auto
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
@@ -2,17 +2,12 @@ module Admin
|
||||
class AccessChecksController < BaseController
|
||||
def new
|
||||
load_options
|
||||
end
|
||||
|
||||
def create
|
||||
load_options
|
||||
@user = User.find_by(id: params[:user_id])
|
||||
@application = Application.find_by(id: params[:application_id])
|
||||
return render :new unless @user && @application
|
||||
return unless @user && @application
|
||||
|
||||
@allowed = @application.user_allowed?(@user)
|
||||
@via = @user.groups & @application.allowed_groups
|
||||
render :new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<div class="bg-white dark:bg-gray-800 shadow sm:rounded-lg">
|
||||
<div class="px-4 py-5 sm:p-6">
|
||||
<%= form_with url: admin_access_path, method: :post, class: "space-y-4" do |form| %>
|
||||
<%= form_with url: admin_access_path, method: :get, class: "space-y-4" do |form| %>
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-2">
|
||||
<div>
|
||||
<%= form.label :user_id, "User", class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %>
|
||||
|
||||
@@ -53,9 +53,10 @@ Rails.application.configure do
|
||||
# Child sources: Allow self for any future iframes
|
||||
policy.child_src :self
|
||||
|
||||
# Additional security headers for WebAuthn
|
||||
# Required for WebAuthn to work properly
|
||||
policy.require_trusted_types_for :none
|
||||
# Do not enforce Trusted Types. The only valid value for
|
||||
# require-trusted-types-for is 'script'; there is no 'none' token, so
|
||||
# emitting it produces an invalid directive that browsers reject. To leave
|
||||
# Trusted Types unenforced (needed for WebAuthn), omit the directive entirely.
|
||||
|
||||
# CSP reporting using report_uri (supported method)
|
||||
policy.report_uri "/api/csp-violation-report"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Clinch
|
||||
VERSION = "0.16.0"
|
||||
VERSION = "0.16.2"
|
||||
end
|
||||
|
||||
@@ -96,7 +96,6 @@ Rails.application.routes.draw do
|
||||
end
|
||||
resources :groups
|
||||
get "access", to: "access_checks#new"
|
||||
post "access", to: "access_checks#create"
|
||||
end
|
||||
|
||||
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
||||
|
||||
@@ -15,8 +15,8 @@ module Admin
|
||||
assert_match "alice@example.com", response.body
|
||||
end
|
||||
|
||||
test "create returns 'can access' with via group when user is in an allowed group" do
|
||||
post admin_access_path, params: {
|
||||
test "returns 'can access' with via group when user is in an allowed group" do
|
||||
get admin_access_path, params: {
|
||||
user_id: users(:alice).id,
|
||||
application_id: @kavita.id
|
||||
}
|
||||
@@ -25,9 +25,9 @@ module Admin
|
||||
assert_match "Administrators", response.body # alice is in admin_group; kavita has admin_group
|
||||
end
|
||||
|
||||
test "create returns 'cannot access' with reason when user shares no group with the app" do
|
||||
test "returns 'cannot access' with reason when user shares no group with the app" do
|
||||
lonely = User.create!(email_address: "lonely@example.com", password: "password123", skip_auto_assign: true)
|
||||
post admin_access_path, params: {
|
||||
get admin_access_path, params: {
|
||||
user_id: lonely.id,
|
||||
application_id: @kavita.id
|
||||
}
|
||||
@@ -36,8 +36,8 @@ module Admin
|
||||
assert_match "shares no group", response.body
|
||||
end
|
||||
|
||||
test "create renders form unchanged when ids are missing" do
|
||||
post admin_access_path, params: {user_id: "", application_id: ""}
|
||||
test "renders form unchanged when ids are missing" do
|
||||
get admin_access_path, params: {user_id: "", application_id: ""}
|
||||
assert_response :success
|
||||
# No result panel should render. The panel-only phrases:
|
||||
refute_match "Granted via", response.body
|
||||
|
||||
Reference in New Issue
Block a user