diff --git a/CHANGELOG.md b/CHANGELOG.md index 86cb9bf..100ae74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org) using the following scheme: MAJOR.MINOR.PATCH +## [0.58.0] - 2026-07-08 + +### Added +- Multicompany user permissions + ## [0.57.0] - 2026-07-07 ### Added diff --git a/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissions.swift b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissions.swift index 9722690..78315a2 100644 --- a/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissions.swift +++ b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissions.swift @@ -46,6 +46,7 @@ public struct DolibarrUserPermissions: Codable, Hashable { public var stock: DolibarrUserPermissionsStock? public var projet: DolibarrUserPermissionsProject? public var lareponse: DolibarrUserPermissionsLaReponse? + public var multicompany: DolibarrUserPermissionsMulticompany? // MARK: - Inits @@ -63,7 +64,8 @@ public struct DolibarrUserPermissions: Codable, Hashable { barcode: DolibarrUserPermissionsBarcode? = nil, stock: DolibarrUserPermissionsStock? = nil, projet: DolibarrUserPermissionsProject? = nil, - lareponse: DolibarrUserPermissionsLaReponse? = nil + lareponse: DolibarrUserPermissionsLaReponse? = nil, + multicompany: DolibarrUserPermissionsMulticompany? = nil ) { self.user = user self.expensereport = expensereport @@ -79,6 +81,7 @@ public struct DolibarrUserPermissions: Codable, Hashable { self.stock = stock self.projet = projet self.lareponse = lareponse + self.multicompany = multicompany } public init(from decoder: any Decoder) throws { @@ -97,6 +100,7 @@ public struct DolibarrUserPermissions: Codable, Hashable { self.stock = try container.decodeIfPresent(DolibarrUserPermissionsStock.self, forKey: .stock) self.projet = try container.decodeIfPresent(DolibarrUserPermissionsProject.self, forKey: .projet) self.lareponse = try container.decodeIfPresent(DolibarrUserPermissionsLaReponse.self, forKey: .lareponse) + self.multicompany = try container.decodeIfPresent(DolibarrUserPermissionsMulticompany.self, forKey: .multicompany) } } diff --git a/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsInvoice.swift b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsInvoice.swift index 92449e6..bbf528b 100644 --- a/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsInvoice.swift +++ b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsInvoice.swift @@ -13,7 +13,7 @@ // limitations under the License. // -// File.swift +// DolibarrUserPermissionsInvoice.swift // SwiftDolibarr // // Created by William Mead on 09/03/2026. diff --git a/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsMulticompany.swift b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsMulticompany.swift new file mode 100644 index 0000000..e3556c6 --- /dev/null +++ b/Sources/SwiftDolibarr/Models/Core/User/DolibarrUserPermissionsMulticompany.swift @@ -0,0 +1,67 @@ +// Copyright 2026 M34D - William Mead +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +// DolibarrUserPermissionsMulticompany.swift +// SwiftDolibarr +// +// Created by William Mead on 07/07/2026. +// + +import Foundation + +/// Multicompany module permissions for a Dolibarr user. +/// +/// - SeeAlso: ``DolibarrUserPermissions`` +public struct DolibarrUserPermissionsMulticompany: Codable, Hashable { + + // MARK: - Properties + + public var read: Int? + public var write: Int? + public var delete: Int? + public var create: Int? + + // MARK: - Enums + + enum CodingKeys: String, CodingKey { + case read + case write + case delete + case create + } + + // MARK: - Inits + + public init( + read: Int? = nil, + write: Int? = nil, + delete: Int? = nil, + create: Int? = nil + ) { + self.read = read + self.write = write + self.delete = delete + self.create = create + } + + public init(from decoder: any Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.read = try container.decodeIfPresent(Int.self, forKey: .read) + self.write = try container.decodeIfPresent(Int.self, forKey: .write) + self.delete = try container.decodeIfPresent(Int.self, forKey: .delete) + self.create = try container.decodeIfPresent(Int.self, forKey: .create) + } + +}