This commit is contained in:
parent
18aac0010c
commit
00f7dd2955
11
README.md
11
README.md
|
@ -6,19 +6,24 @@ Users, Libraries, Plugins, Settings, etc.
|
|||
# Progress
|
||||
|
||||
- [x] Creating .xml files
|
||||
- [ ] Modifying databate
|
||||
- [x] Modifying databate
|
||||
- [ ] Test cases
|
||||
- [x] XML Generation
|
||||
- [x] Networking
|
||||
- [ ] Encoding
|
||||
- [ ] System
|
||||
- [ ] Users
|
||||
- [x] Create users
|
||||
- [ ] Delete users
|
||||
- [ ] Insert users in middle (test InternalId)
|
||||
- [ ] MustUpdatePassword test
|
||||
- [ ] Libraries
|
||||
- [ ] Connecting
|
||||
- [ ] Fetching files
|
||||
|
||||
- [ ] Users
|
||||
- [ ] Hashed passwords
|
||||
- [x] Users
|
||||
- [x] Hashed passwords
|
||||
- [ ] Mutable users (override Users table with configured users table if false, like in nixpkgs user-groups.nix)
|
||||
- [ ] Libraries
|
||||
- [ ] Plugins
|
||||
- [ ] Settings
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
tests = system:
|
||||
builtins.listToAttrs (builtins.map
|
||||
(x: let
|
||||
test = import (./tests + "/${x}") {
|
||||
test = import (./tests/autorun + "/${x}") {
|
||||
pkgs = import nixpkgs {inherit system;};
|
||||
};
|
||||
in {
|
||||
|
@ -31,7 +31,7 @@
|
|||
if value == "regular"
|
||||
then name
|
||||
else null))
|
||||
(builtins.readDir ./tests))
|
||||
(builtins.readDir ./tests/autorun))
|
||||
));
|
||||
in {
|
||||
formatter = forAllSystems (
|
||||
|
|
|
@ -201,5 +201,49 @@ in {
|
|||
''
|
||||
);
|
||||
};
|
||||
assertions = [
|
||||
# NOTE: probably a retarded way of looping over users
|
||||
# im not a functional mf
|
||||
|
||||
# Make sure that either Password or HashPasswordFile is provided
|
||||
{
|
||||
assertion =
|
||||
lib.lists.findFirst
|
||||
(x: x == false)
|
||||
true
|
||||
(
|
||||
map
|
||||
(user: user.HashedPasswordFile != null || user.Password != null)
|
||||
cfg.Users
|
||||
);
|
||||
message = "Must Provide either Password or HashedPasswordFile";
|
||||
}
|
||||
# Make sure not both Password and HashPasswordFile is set
|
||||
{
|
||||
assertion =
|
||||
lib.lists.findFirst
|
||||
(x: x == false)
|
||||
true
|
||||
(
|
||||
map
|
||||
(user: !(user.HashedPasswordFile != null && user.Password != null))
|
||||
cfg.Users
|
||||
);
|
||||
message = "Can not set both Password and HashedPasswordFile";
|
||||
}
|
||||
# Check if username provided
|
||||
{
|
||||
assertion =
|
||||
lib.lists.findFirst
|
||||
(x: x == false)
|
||||
true
|
||||
(
|
||||
map
|
||||
(user: !(isNull user.Username))
|
||||
cfg.Users
|
||||
);
|
||||
message = "Must set a username for user";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -89,8 +89,8 @@ with lib; {
|
|||
default = null;
|
||||
};
|
||||
Password = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
};
|
||||
HashedPasswordFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
|
|
|
@ -11,7 +11,7 @@ in {
|
|||
...
|
||||
}: {
|
||||
imports = [
|
||||
../modules/default.nix
|
||||
../../modules/default.nix
|
||||
];
|
||||
|
||||
virtualisation.memorySize = 1024;
|
||||
|
@ -28,6 +28,10 @@ in {
|
|||
Username = "admin";
|
||||
Password = "123";
|
||||
}
|
||||
{
|
||||
Username = "other wierd user";
|
||||
HashedPasswordFile = ../example_hash.txt;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
|
@ -11,7 +11,7 @@ in {
|
|||
...
|
||||
}: {
|
||||
imports = [
|
||||
../modules/default.nix
|
||||
../../modules/default.nix
|
||||
];
|
||||
|
||||
virtualisation.memorySize = 1024;
|
|
@ -11,7 +11,7 @@ in {
|
|||
...
|
||||
}: {
|
||||
imports = [
|
||||
../modules/default.nix
|
||||
../../modules/default.nix
|
||||
];
|
||||
|
||||
# assertions = let
|
||||
|
@ -37,7 +37,7 @@ in {
|
|||
assertion = expected == got;
|
||||
message = "[Test: ${name}] Generated XML is incorrect!\nExpected \n\n${expected}\n but got \n\n${got}";
|
||||
};
|
||||
toXml = (import ../lib {nixpkgs = pkgs;}).toXMLGeneric;
|
||||
toXml = (import ../../lib {nixpkgs = pkgs;}).toXMLGeneric;
|
||||
in [
|
||||
(
|
||||
genTest "Single tag"
|
1
tests/example_hash.txt
Normal file
1
tests/example_hash.txt
Normal file
|
@ -0,0 +1 @@
|
|||
$PBKDF2-SHA512$iterations=210000$1268EF06B20D1E0BB64158C39C7C22DA$e6ae3c2a2dac9ee0935636b08c54b69fc20b6fb6e5554d2a35d984abc7c0202b639110811a7ffefa58eedae95c5b0b210a1cfcdda877614ab84b9b914d3b881a
|
Loading…
Reference in a new issue