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
|
# Progress
|
||||||
|
|
||||||
- [x] Creating .xml files
|
- [x] Creating .xml files
|
||||||
- [ ] Modifying databate
|
- [x] Modifying databate
|
||||||
- [ ] Test cases
|
- [ ] Test cases
|
||||||
- [x] XML Generation
|
- [x] XML Generation
|
||||||
- [x] Networking
|
- [x] Networking
|
||||||
- [ ] Encoding
|
- [ ] Encoding
|
||||||
- [ ] System
|
- [ ] System
|
||||||
- [ ] Users
|
- [ ] Users
|
||||||
|
- [x] Create users
|
||||||
|
- [ ] Delete users
|
||||||
|
- [ ] Insert users in middle (test InternalId)
|
||||||
|
- [ ] MustUpdatePassword test
|
||||||
- [ ] Libraries
|
- [ ] Libraries
|
||||||
- [ ] Connecting
|
- [ ] Connecting
|
||||||
- [ ] Fetching files
|
- [ ] Fetching files
|
||||||
|
|
||||||
- [ ] Users
|
- [x] Users
|
||||||
- [ ] Hashed passwords
|
- [x] Hashed passwords
|
||||||
|
- [ ] Mutable users (override Users table with configured users table if false, like in nixpkgs user-groups.nix)
|
||||||
- [ ] Libraries
|
- [ ] Libraries
|
||||||
- [ ] Plugins
|
- [ ] Plugins
|
||||||
- [ ] Settings
|
- [ ] Settings
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
tests = system:
|
tests = system:
|
||||||
builtins.listToAttrs (builtins.map
|
builtins.listToAttrs (builtins.map
|
||||||
(x: let
|
(x: let
|
||||||
test = import (./tests + "/${x}") {
|
test = import (./tests/autorun + "/${x}") {
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
if value == "regular"
|
if value == "regular"
|
||||||
then name
|
then name
|
||||||
else null))
|
else null))
|
||||||
(builtins.readDir ./tests))
|
(builtins.readDir ./tests/autorun))
|
||||||
));
|
));
|
||||||
in {
|
in {
|
||||||
formatter = forAllSystems (
|
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;
|
default = null;
|
||||||
};
|
};
|
||||||
Password = mkOption {
|
Password = mkOption {
|
||||||
type = types.str;
|
type = with types; nullOr str;
|
||||||
default = "";
|
default = null;
|
||||||
};
|
};
|
||||||
HashedPasswordFile = mkOption {
|
HashedPasswordFile = mkOption {
|
||||||
type = types.nullOr types.path;
|
type = types.nullOr types.path;
|
||||||
|
|
|
@ -11,7 +11,7 @@ in {
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
../modules/default.nix
|
../../modules/default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.memorySize = 1024;
|
virtualisation.memorySize = 1024;
|
||||||
|
@ -28,6 +28,10 @@ in {
|
||||||
Username = "admin";
|
Username = "admin";
|
||||||
Password = "123";
|
Password = "123";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
Username = "other wierd user";
|
||||||
|
HashedPasswordFile = ../example_hash.txt;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
|
@ -11,7 +11,7 @@ in {
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
../modules/default.nix
|
../../modules/default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
virtualisation.memorySize = 1024;
|
virtualisation.memorySize = 1024;
|
|
@ -11,7 +11,7 @@ in {
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
../modules/default.nix
|
../../modules/default.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# assertions = let
|
# assertions = let
|
||||||
|
@ -37,7 +37,7 @@ in {
|
||||||
assertion = expected == got;
|
assertion = expected == got;
|
||||||
message = "[Test: ${name}] Generated XML is incorrect!\nExpected \n\n${expected}\n but got \n\n${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 [
|
in [
|
||||||
(
|
(
|
||||||
genTest "Single tag"
|
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