Skip to content

Commit 2d7b37b

Browse files
authored
Merge branch 'develop' into simpler_logging_refactor
2 parents 3832db8 + ac6d964 commit 2d7b37b

File tree

554 files changed

+8451
-543
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

554 files changed

+8451
-543
lines changed

.github/workflows/codacy-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ name: Codacy Security Scan
1010

1111
on:
1212
push:
13-
branches: [ master ]
13+
branches: [ develop ]
1414
pull_request:
1515
# The branches below must be a subset of the branches above
16-
branches: [ master ]
16+
branches: [ develop ]
1717
schedule:
1818
- cron: '36 23 * * 3'
1919

.github/workflows/docker-intel.yml renamed to .github/workflows/docker-alpine.yml

Lines changed: 6 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Snipe-IT Docker image build for hub.docker.com
2-
name: Docker Intel/amd64 images (Ubuntu)
1+
# Snipe-IT (Alpine) Docker image build for hub.docker.com
2+
name: Docker images (Alpine)
33

44
# Run this Build for all pushes to 'master' or develop branch, or tagged releases.
55
# Also run for PRs to ensure PR doesn't break Docker build process
@@ -19,72 +19,7 @@ permissions:
1919
contents: read
2020

2121
jobs:
22-
docker-ubuntu-intel:
23-
# Ensure this job never runs on forked repos. It's only executed for 'grokability/snipe-it'
24-
if: github.repository == 'grokability/snipe-it'
25-
runs-on: ubuntu-latest
26-
env:
27-
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
28-
# For a new commit on default branch (master), use the literal tag 'latest' on Docker image.
29-
# For a new commit on other branches, use the branch name as the tag for Docker image.
30-
# For a new tag, copy that tag name as the tag for Docker image.
31-
IMAGE_TAGS: |
32-
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }}
33-
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }}
34-
type=ref,event=tag
35-
type=semver,pattern=v{{major}}-latest
36-
# Define default tag "flavor" for docker/metadata-action per
37-
# https://github.com/docker/metadata-action#flavor-input
38-
# We turn off 'latest' tag by default.
39-
TAGS_FLAVOR: |
40-
latest=false
41-
42-
steps:
43-
# https://github.com/actions/checkout
44-
- name: Checkout codebase
45-
uses: actions/checkout@v4
46-
47-
# https://github.com/docker/setup-buildx-action
48-
- name: Setup Docker Buildx
49-
uses: docker/setup-buildx-action@v3
50-
51-
# https://github.com/docker/login-action
52-
- name: Login to DockerHub
53-
# Only login if not a PR, as PRs only trigger a Docker build and not a push
54-
if: github.event_name != 'pull_request'
55-
uses: docker/login-action@v3
56-
with:
57-
username: ${{ secrets.DOCKER_USERNAME }}
58-
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
59-
60-
###############################################
61-
# Build/Push the 'snipe/snipe-it' image
62-
###############################################
63-
# https://github.com/docker/metadata-action
64-
# Get Metadata for docker_build step below
65-
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
66-
id: meta_build
67-
uses: docker/metadata-action@v5
68-
with:
69-
images: snipe/snipe-it
70-
tags: ${{ env.IMAGE_TAGS }}
71-
flavor: ${{ env.TAGS_FLAVOR }}
72-
73-
# https://github.com/docker/build-push-action
74-
- name: Build and push 'snipe-it' image
75-
id: docker_build
76-
uses: docker/build-push-action@v6
77-
with:
78-
context: .
79-
file: ./Dockerfile
80-
platforms: linux/amd64
81-
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
82-
# but we ONLY do an image push to DockerHub if it's NOT a PR
83-
push: ${{ github.event_name != 'pull_request' }}
84-
# Use tags / labels provided by 'docker/metadata-action' above
85-
tags: ${{ steps.meta_build.outputs.tags }}
86-
labels: ${{ steps.meta_build.outputs.labels }}
87-
docker-alpine-intel:
22+
docker:
8823
# Ensure this job never runs on forked repos. It's only executed for 'grokability/snipe-it'
8924
if: github.repository == 'grokability/snipe-it'
9025
runs-on: ubuntu-latest
@@ -123,15 +58,15 @@ jobs:
12358
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
12459

12560
###############################################
126-
# Build/Push the 'grokability/snipe-it' image
61+
# Build/Push the 'snipe/snipe-it' image
12762
###############################################
12863
# https://github.com/docker/metadata-action
12964
# Get Metadata for docker_build step below
13065
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
13166
id: meta_build
13267
uses: docker/metadata-action@v5
13368
with:
134-
images: grokability/snipe-it
69+
images: snipe/snipe-it
13570
tags: ${{ env.IMAGE_TAGS }}
13671
flavor: ${{ env.TAGS_FLAVOR }}
13772

@@ -142,7 +77,7 @@ jobs:
14277
with:
14378
context: .
14479
file: ./Dockerfile.alpine
145-
platforms: linux/amd64
80+
platforms: linux/amd64,linux/arm64
14681
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
14782
# but we ONLY do an image push to DockerHub if it's NOT a PR
14883
push: ${{ github.event_name != 'pull_request' }}

.github/workflows/docker-arm.yml renamed to .github/workflows/docker-ubuntu.yml

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Snipe-IT Docker image build for hub.docker.com
2-
name: Docker cross-platform images (Ubuntu and Alpine)
2+
name: Docker images (Ubuntu)
33

44
# Run this Build for all pushes to 'master' or develop branch, or tagged releases.
55
# Also run for PRs to ensure PR doesn't break Docker build process
@@ -19,10 +19,10 @@ permissions:
1919
contents: read
2020

2121
jobs:
22-
docker-ubuntu-arm:
22+
docker:
2323
# Ensure this job never runs on forked repos. It's only executed for 'grokability/snipe-it'
2424
if: github.repository == 'grokability/snipe-it'
25-
runs-on: ubuntu-24.04-arm
25+
runs-on: ubuntu-latest
2626
env:
2727
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
2828
# For a new commit on default branch (master), use the literal tag 'latest' on Docker image.
@@ -77,72 +77,7 @@ jobs:
7777
with:
7878
context: .
7979
file: ./Dockerfile
80-
platforms: linux/arm64
81-
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
82-
# but we ONLY do an image push to DockerHub if it's NOT a PR
83-
push: ${{ github.event_name != 'pull_request' }}
84-
# Use tags / labels provided by 'docker/metadata-action' above
85-
tags: ${{ steps.meta_build.outputs.tags }}
86-
labels: ${{ steps.meta_build.outputs.labels }}
87-
docker-alpine-arm:
88-
# Ensure this job never runs on forked repos. It's only executed for 'grokability/snipe-it'
89-
if: github.repository == 'grokability/snipe-it'
90-
runs-on: ubuntu-24.04-arm
91-
env:
92-
# Define tags to use for Docker images based on Git tags/branches (for docker/metadata-action)
93-
# For a new commit on default branch (master), use the literal tag 'latest' on Docker image.
94-
# For a new commit on other branches, use the branch name as the tag for Docker image.
95-
# For a new tag, copy that tag name as the tag for Docker image.
96-
IMAGE_TAGS: |
97-
type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }},suffix=-alpine
98-
type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }},suffix=-alpine
99-
type=ref,event=tag,suffix=-alpine
100-
type=semver,pattern=v{{major}}-latest-alpine
101-
# Define default tag "flavor" for docker/metadata-action per
102-
# https://github.com/docker/metadata-action#flavor-input
103-
# We turn off 'latest' tag by default.
104-
TAGS_FLAVOR: |
105-
latest=false
106-
107-
steps:
108-
# https://github.com/actions/checkout
109-
- name: Checkout codebase
110-
uses: actions/checkout@v4
111-
112-
# https://github.com/docker/setup-buildx-action
113-
- name: Setup Docker Buildx
114-
uses: docker/setup-buildx-action@v3
115-
116-
# https://github.com/docker/login-action
117-
- name: Login to DockerHub
118-
# Only login if not a PR, as PRs only trigger a Docker build and not a push
119-
if: github.event_name != 'pull_request'
120-
uses: docker/login-action@v3
121-
with:
122-
username: ${{ secrets.DOCKER_USERNAME }}
123-
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}
124-
125-
###############################################
126-
# Build/Push the 'snipe/snipe-it' image
127-
###############################################
128-
# https://github.com/docker/metadata-action
129-
# Get Metadata for docker_build step below
130-
- name: Sync metadata (tags, labels) from GitHub to Docker for 'snipe-it' image
131-
id: meta_build
132-
uses: docker/metadata-action@v5
133-
with:
134-
images: snipe/snipe-it
135-
tags: ${{ env.IMAGE_TAGS }}
136-
flavor: ${{ env.TAGS_FLAVOR }}
137-
138-
# https://github.com/docker/build-push-action
139-
- name: Build and push 'snipe-it' image
140-
id: docker_build
141-
uses: docker/build-push-action@v6
142-
with:
143-
context: .
144-
file: ./Dockerfile.alpine
145-
platforms: linux/arm64,linux/amd64
80+
platforms: linux/amd64,linux/arm64
14681
# For pull requests, we run the Docker build (to ensure no PR changes break the build),
14782
# but we ONLY do an image push to DockerHub if it's NOT a PR
14883
push: ${{ github.event_name != 'pull_request' }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![snipe-it-by-grok](https://github.com/grokability/snipe-it/assets/197404/b515673b-c7c8-4d9a-80f5-9fa58829a602)
22

3-
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/553ce52037fc43ea99149785afcfe641)](https://app.codacy.com/gh/snipe/snipe-it/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Tests](https://github.com/grokability/snipe-it/actions/workflows/tests.yml/badge.svg)](https://github.com/grokability/snipe-it/actions/workflows/tests.yml)
3+
[![Crowdin](https://d322cqt584bo4o.cloudfront.net/snipe-it/localized.svg)](https://crowdin.com/project/snipe-it) [![Docker Pulls](https://img.shields.io/docker/pulls/snipe/snipe-it.svg)](https://hub.docker.com/r/snipe/snipe-it/) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/804dd1beb14a41f38810ab77d64fc4fc)](https://app.codacy.com/gh/grokability/snipe-it/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Tests](https://github.com/grokability/snipe-it/actions/workflows/tests.yml/badge.svg)](https://github.com/grokability/snipe-it/actions/workflows/tests.yml)
44
[![All Contributors](https://img.shields.io/badge/all_contributors-331-orange.svg?style=flat-square)](#contributing) [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/yZFtShAcKk)
55

66
## Snipe-IT - Open Source Asset Management System

app/Console/Commands/RestoreFromBackup.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ public function handle()
249249
'storage/private_uploads/consumables',
250250
'storage/private_uploads/eula-pdfs',
251251
'storage/private_uploads/imports',
252+
'storage/private_uploads/locations',
252253
'storage/private_uploads/licenses',
253254
'storage/private_uploads/signatures',
254255
'storage/private_uploads/users',

app/Helpers/Helper.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ public static function deprecationCheck() : array {
722722
// The check and message that the user is still using the deprecated version
723723
$deprecations = [
724724
'ms_teams_deprecated' => array(
725-
'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows'),
726-
'message' => 'The Microsoft Teams webhook URL being used will be deprecated Jan 31st, 2025. <a class="btn btn-primary" href="' . route('settings.slack.index') . '">Change webhook endpoint</a>'),
725+
'check' => !Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows') && (Setting::getSettings()->webhook_selected === 'microsoft'),
726+
'message' => 'The Microsoft Teams webhook URL being used will be deprecated Dec 31st, 2025. <a class="btn btn-primary" href="' . route('settings.slack.index') . '">Change webhook endpoint</a>'),
727727
];
728728

729729
// if item of concern is being used and its being used with the deprecated values return the notification array.
@@ -1487,6 +1487,7 @@ static public function getRedirectOption($request, $id, $table, $item_id = null)
14871487
$redirect_option = Session::get('redirect_option');
14881488
$checkout_to_type = Session::get('checkout_to_type');
14891489
$checkedInFrom = Session::get('checkedInFrom');
1490+
$other_redirect = Session::get('other_redirect');
14901491

14911492
// return to index
14921493
if ($redirect_option == 'index') {
@@ -1535,6 +1536,16 @@ static public function getRedirectOption($request, $id, $table, $item_id = null)
15351536
return route('hardware.show', $request->assigned_asset ?? $checkedInFrom);
15361537
}
15371538
}
1539+
1540+
// return to somewhere else
1541+
if ($redirect_option == 'other_redirect') {
1542+
switch ($other_redirect) {
1543+
case 'audit':
1544+
return route('assets.audit.due');
1545+
}
1546+
1547+
}
1548+
15381549
return redirect()->back()->with('error', trans('admin/hardware/message.checkout.error'));
15391550
}
15401551

app/Http/Controllers/Api/CategoriesController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function index(Request $request) : array
5656
'notes',
5757
])
5858
->with('adminuser')
59-
->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count');
59+
->withCount('accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count', 'models as models_count');
6060

6161

6262
/*
@@ -212,7 +212,7 @@ public function update(ImageUploadRequest $request, $id) : JsonResponse
212212
public function destroy($id) : JsonResponse
213213
{
214214
$this->authorize('delete', Category::class);
215-
$category = Category::withCount('assets as assets_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count')->findOrFail($id);
215+
$category = Category::withCount('assets as assets_count', 'accessories as accessories_count', 'consumables as consumables_count', 'components as components_count', 'licenses as licenses_count', 'models as models_count')->findOrFail($id);
216216

217217
if (! $category->isDeletable()) {
218218
return response()->json(

app/Http/Controllers/Api/LicenseSeatsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function index(Request $request, $licenseId) : JsonResponse | array
3535
if ($request->input('sort') == 'department') {
3636
$seats->OrderDepartments($order);
3737
} else {
38-
$seats->orderBy('id', $order);
38+
$seats->orderBy('updated_at', $order);
3939
}
4040

4141
$total = $seats->count();

app/Http/Controllers/Assets/AssetCheckinController.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@ public function create(Asset $asset, $backto = null) : View | RedirectResponse
4242
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
4343
}
4444

45-
// Validate custom fields on existing asset
46-
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
45+
// Invoke the validation to see if the audit will complete successfully
46+
$asset->setRules($asset->getRules() + $asset->customFieldValidationRules());
4747

48-
if ($validator->fails()) {
49-
return redirect()->route('hardware.edit', $asset)
50-
->withErrors($validator);
48+
if ($asset->isInvalid()) {
49+
return redirect()->route('hardware.edit', $asset)->withErrors($asset->getErrors());
5150
}
5251

5352
$target_option = match ($asset->assigned_type) {

app/Http/Controllers/Assets/AssetCheckoutController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ public function create(Asset $asset) : View | RedirectResponse
3737
->with('error', trans('admin/hardware/general.model_invalid_fix'));
3838
}
3939

40-
// Validate custom fields on existing asset
41-
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
40+
// Invoke the validation to see if the audit will complete successfully
41+
$asset->setRules($asset->getRules() + $asset->customFieldValidationRules());
4242

43-
if ($validator->fails()) {
44-
return redirect()->route('hardware.edit', $asset)
45-
->withErrors($validator);
43+
if ($asset->isInvalid()) {
44+
return redirect()->route('hardware.edit', $asset)->withErrors($asset->getErrors());
4645
}
46+
4747

4848
if ($asset->availableForCheckout()) {
4949
return view('hardware/checkout', compact('asset'))

0 commit comments

Comments
 (0)