Compare commits
No commits in common. "develop" and "main" have entirely different histories.
6 changed files with 0 additions and 211 deletions
17
CHANGELOG.md
17
CHANGELOG.md
|
@ -1,17 +0,0 @@
|
||||||
## 0.1.0a2 (2025-02-17)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- support hidden attribut
|
|
||||||
|
|
||||||
## 0.1.0a1 (2025-02-17)
|
|
||||||
|
|
||||||
### Fix
|
|
||||||
|
|
||||||
- annotator is in structural plugin
|
|
||||||
|
|
||||||
## 0.1.0a0 (2025-02-13)
|
|
||||||
|
|
||||||
### Feat
|
|
||||||
|
|
||||||
- first version
|
|
|
@ -1,41 +0,0 @@
|
||||||
[build-system]
|
|
||||||
build-backend = "flit_core.buildapi"
|
|
||||||
requires = ["flit_core >=3.8.0,<4"]
|
|
||||||
|
|
||||||
[project]
|
|
||||||
name = "rougail.structural_bitwarden"
|
|
||||||
version = "0.1.0a2"
|
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
|
||||||
readme = "README.md"
|
|
||||||
description = "Rougail structural Bitwarden"
|
|
||||||
requires-python = ">=3.8"
|
|
||||||
license = {file = "LICENSE"}
|
|
||||||
classifiers = [
|
|
||||||
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
"Programming Language :: Python :: 3.8",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
"Programming Language :: Python :: 3.12",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Natural Language :: English",
|
|
||||||
"Natural Language :: French",
|
|
||||||
|
|
||||||
]
|
|
||||||
dependencies = [
|
|
||||||
"rougail >= 1.1,<2",
|
|
||||||
"rougail-user-data-bitwarden >= 0.0,<2",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.urls]
|
|
||||||
Home = "https://forge.cloud.silique.fr/stove/rougail-structural-bitwarden"
|
|
||||||
|
|
||||||
[tool.commitizen]
|
|
||||||
name = "cz_conventional_commits"
|
|
||||||
tag_format = "$version"
|
|
||||||
version_scheme = "pep440"
|
|
||||||
version_provider = "pep621"
|
|
||||||
update_changelog_on_bump = true
|
|
||||||
changelog_merge_prerelease = true
|
|
|
@ -1,21 +0,0 @@
|
||||||
"""
|
|
||||||
Silique (https://www.silique.fr)
|
|
||||||
Copyright (C) 2025
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
from .object_model import Variable
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("Variable",)
|
|
|
@ -1,69 +0,0 @@
|
||||||
"""
|
|
||||||
Silique (https://www.silique.fr)
|
|
||||||
Copyright (C) 2025
|
|
||||||
|
|
||||||
distribued with GPL-2 or later license
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
"""
|
|
||||||
from rougail.error import DictConsistencyError
|
|
||||||
from rougail.annotator.variable import Walk
|
|
||||||
from .i18n import _
|
|
||||||
|
|
||||||
|
|
||||||
class Annotator(Walk):
|
|
||||||
"""Annotate for bitwarden"""
|
|
||||||
|
|
||||||
level = 95
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
objectspace,
|
|
||||||
*args, # pylint: disable=unused-argument
|
|
||||||
) -> None:
|
|
||||||
if not objectspace.paths:
|
|
||||||
return
|
|
||||||
self.objectspace = objectspace
|
|
||||||
self.check_variable()
|
|
||||||
|
|
||||||
def check_variable(self):
|
|
||||||
for variable in self.get_variables():
|
|
||||||
if not variable.bitwarden:
|
|
||||||
continue
|
|
||||||
path = variable.path
|
|
||||||
if variable.type not in ["unix_user", "secret"]:
|
|
||||||
msg = _('only "unix_user" or "secret" variable type can have "bitwarden" attribute, but "{0}" has type "{1}"')
|
|
||||||
raise DictConsistencyError(msg.format(path, variable.type), 301, variable.xmlfiles)
|
|
||||||
if variable.multi and path not in self.objectspace.leaders:
|
|
||||||
msg = _('the variable "{0}" has attribute "bitwarden" but is a multi variable')
|
|
||||||
raise DictConsistencyError(msg.format(path), 302, variable.xmlfiles)
|
|
||||||
check_default_value = True
|
|
||||||
if path in self.objectspace.followers:
|
|
||||||
leadership = path.rsplit('.', 1)[0]
|
|
||||||
leader_path = self.objectspace.parents[leadership][0]
|
|
||||||
leader = self.objectspace.paths[leader_path]
|
|
||||||
if leader.bitwarden:
|
|
||||||
if variable.default:
|
|
||||||
msg = _('the variable "{0}" is a follower and leader variable ("{1}") is also in Bitwarden so this variable could not have default value')
|
|
||||||
raise DictConsistencyError(msg.format(path, leader_path), 303, variable.xmlfiles)
|
|
||||||
check_default_value = False
|
|
||||||
if check_default_value and not variable.default:
|
|
||||||
msg = _('the variable "{0}" is in Bitwarden so should have default value')
|
|
||||||
raise DictConsistencyError(msg.format(path), 304, variable.xmlfiles)
|
|
||||||
self.objectspace.informations.add(path, "bitwarden", True)
|
|
||||||
self.objectspace.informations.add(path, "default_value_makes_sense", False)
|
|
||||||
self.objectspace.properties.add(path, "novalidator", True)
|
|
||||||
if 'force_default_on_freeze' in self.objectspace.properties.get(path):
|
|
||||||
self.objectspace.properties.remove(path, 'force_default_on_freeze')
|
|
|
@ -1,32 +0,0 @@
|
||||||
"""
|
|
||||||
Silique (https://www.silique.fr)
|
|
||||||
Copyright (C) 2025
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
|
||||||
Free Software Foundation, either version 3 of the License, or (at your
|
|
||||||
option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def get_rougail_config(
|
|
||||||
*,
|
|
||||||
backward_compatibility: bool = True, # pylint: disable=unused-argument
|
|
||||||
) -> dict:
|
|
||||||
return {
|
|
||||||
"name": "bitwarden",
|
|
||||||
"process": "structural",
|
|
||||||
"level": 90,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ("get_rougail_config",)
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
"""
|
|
||||||
Silique (https://www.silique.fr)
|
|
||||||
Copyright (C) 2025
|
|
||||||
|
|
||||||
distribued with GPL-2 or later license
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
"""
|
|
||||||
from typing import Optional
|
|
||||||
from pydantic import BaseModel
|
|
||||||
|
|
||||||
|
|
||||||
class Variable(BaseModel):
|
|
||||||
bitwarden: bool=False
|
|
||||||
|
|
||||||
|
|
||||||
__all__ = ('Variable',)
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue