Commit graph

55 commits

Author SHA1 Message Date
c954940bec tests: Adds verificator-tests & lib: __init__ file
Also more strings to operate on for the tests, obviously.
2020-06-12 13:44:53 +02:00
108492db3f private/lib/Validator.py: Further code quality enhancements
Namely:
* f => file_handle
* errstr => err_str
* intendantion adjustements.
* factor out uneccessary if-return-else-return-clause.

Also a new functionality to NOT check for users existence but everything
else. Needed to sanitize in case it's a backup of the current running
instance already. This further adds to commit
b4bb45ef85.
2020-05-30 16:46:30 +02:00
d2f99d95d0 sqlitedb.py: Refactor naming
safequery->safe_query, more snake_case all over the place enforced.
2020-05-30 13:54:03 +02:00
fb620447c7 config_ui: Always point out that the script can operate on the ENV 2020-05-30 12:23:23 +02:00
aae7504e13 ListUsers.py: Externalize class & rename some variables
This actually makes the whole file easier to read and maintain. I've
still to refactor the output to something.
2020-05-30 09:51:25 +02:00
df1d09a155 Forgot that message. x_X 2019-10-25 10:19:54 +02:00
8008fa36b9 General overhaul, better messages, ordered imports etc 2019-10-25 10:17:39 +02:00
32c6ea7e07 System: Rename aio_register to aio_approve. 2019-10-25 06:49:43 +02:00
8d4d2038d3 Typing support and sqlite3.Row!
Typing will be handy in further development, as well will i settle down
to sqlite3.Row. Fetchall() returns now a list(grr) with
dict-imitating/sumating objects, which you can call keys() on and will
return them, what we now already use for Backups, which comes handy.

Also Typing gives the ability to let the code even more documentate
itself. It's planned to use all over the place but i've to read myself
into it yet more to get started on that one.
It's a step in the right direction!
2019-10-25 03:03:47 +02:00
b7ffedfba2 Rename SQLitedb to SQLiteDB 2019-10-23 18:13:42 +02:00
fb4b577eb8 minor adjustemenets 2019-10-23 18:12:58 +02:00
f31117e940 System: aio_register, performs all neccessary steps to create user...
BUT will NOT catch ANY exceptions. Therefore the caller script itself is
REQUIRED to catch.
2019-10-23 17:50:13 +02:00
05f27078f6 System: Refactors username given in constructor
deleted all references and added one class which accepts to set a
username
2019-10-23 17:37:59 +02:00
b4d4fd9ad4 System: Improved return calls at remove_user 2019-10-23 15:02:21 +02:00
0eeafa626e Documentation work all over the place
Renamed also some paramters
2019-10-23 14:27:48 +02:00
389b614de9 Revert "ListUsers: UAP and APP renamed, function updates /home/users.txt"
This reverts commit 84cc83db3c.
2019-10-22 15:52:00 +02:00
84cc83db3c ListUsers: UAP and APP renamed, function updates /home/users.txt
On every register() call the System rewrites the /home/users.txt to
reflect currently active users. Will fall apart when something
unexpected happened, but that's @helix responsibility.
2019-10-22 15:47:17 +02:00
6ea679cb60 System: userdel returns 6 when no maildir is deleted but homedir is
So we agree on that one!
2019-10-22 13:50:14 +02:00
eb6f3da3d7 System: Account for userdel returning 6 on success...
just because it couldnt delete the users mail.
2019-10-21 18:33:14 +02:00
7091cbcbd2 Validator: checkName taken from registration form 2019-10-21 13:07:30 +02:00
7786df3761 System: Introduce function to write just write the auth file 2019-10-20 15:24:11 +02:00
96097e26b1 Catched that little error and killed it! 2019-10-20 15:23:46 +02:00
710ceacd7c Breaking up the code smell regarding the CFG.py!
It began smelling already but having some duplicate code across the
interfaces is still better than having all of it all over the place.

It enables to write specific flags which are nice to have. For example,
Import.py requires the --Import flag because it WANTS the user to read
the whole Help before it acts actually as an importer. When the user
supplies something they should know what's currently happening.

Also removes the hardcoded dependency on lib.CFG-Calls from most calls
which was already embarassingly present. Introduced some db and
cfg-variables which doesnt clutter anything but suck much less.

In future we provide a set of default arguments and a bare minimum -
config_ui as the bare minimum, default as the full blown storm.

This is rather big because it also patches several other smells
including a bug where a user from the db wouldnt be reported as existent
2019-10-19 22:36:00 +02:00
934b6bf75a Factor out 'as CFG' 2019-10-19 14:32:01 +02:00
670aa3d9c3 Factor out CONF_FILE 2019-10-19 14:27:34 +02:00
cdc72a30f4 Factor out REG_FILE 2019-10-19 14:25:43 +02:00
77efb4b339 delete cfgparse again and get it going as it where before 2019-10-19 14:21:46 +02:00
8c3ac4060f Split CFG.py to private/lib/cfgparse.py 2019-10-19 14:04:19 +02:00
192e70e4a2 Seperate out even more, own dir for UIs
default UI is now in private/lib/uis/default.py
2019-10-19 13:57:00 +02:00
5c6ecaf627 Modularize CFG.py into CWD, default_cmd and cmd ui 2019-10-19 13:50:30 +02:00
5a57a62780 Allow uppercase Chars afters first character in usernames 2019-10-17 15:27:57 +02:00
91b5e6ae7b Positional fix: OperationalError before general 2019-10-17 15:27:38 +02:00
77a31a44d1 Abort on errors in import file before even trying to activate
Moves every check regarding the imported file outside of import.py into
the validator. Also removes every follow-up checks regarding it out of
import.py.

Looks a whole lot cleaner now!
2019-10-17 14:42:13 +02:00
2ab27aa019 Validate Timestamps and don't not insert into DB when error
Validates now the timestamp in the import.py, doesn't insert users into
the sqlite-database before creating the systems account and checks now
for existence in the database too(unapproved users, who comes first,
gets his name first..)
2019-10-17 14:05:17 +02:00
b0856b558e Move import related stuff to the Import.py script.
and delete occurences in Import It is much tidier to look at and
doesn't clutter the Script. Is even a whole seperate task
so it does make no sense to call it in Backup when i think about it.
2019-10-17 11:57:29 +02:00
283143104d Actually we allow currently strange things, this fixes it on the usernames 2019-10-16 22:48:50 +02:00
d517db3b2a On Operational Exceptions we create the table and try again
this could potentially result in a endless recursion when the
table isnt writeable and a lot other funny things happen
but normally and in 99,999999999% of our cases this
is totally fine
2019-10-16 20:54:49 +02:00
a1563116f6 Renamed SSH-Exception 2019-10-16 20:54:34 +02:00
0c1f7ea252 Validate even imported files and users
Created a new file for the validation functions, should be soon(TM) used too
in the userapplication-script but dont hurry
2019-10-16 20:53:47 +02:00
8274cbb27e unregister() is just a different word for removing 2019-10-16 16:58:20 +02:00
96c403a3d9 Introducing own Exception classes to distinguish between possible System errors 2019-10-16 16:21:14 +02:00
cd8fe5fed0 commit on querys 2019-10-16 14:33:17 +02:00
2202af7826 Introduce imports, which comes with a new flag(--Import)
--Import depends on --file being present pointing to a valid CSV-file
that contains unique users with id's. When a user already exists
with his id, the script will fail.
It is also Backup.py-only which is reflected in the help message
2019-10-16 12:37:54 +02:00
e0efeee67d Better error handling, just hang a freakin' / to ssh_dir if it got screwed up 2019-10-13 22:44:30 +02:00
43c7636920 Make PEP8 finally happy 2019-10-13 21:12:17 +02:00
290e72f159 Add various documentation to the System class and sqlitedb-Class...
... which are all written in rst-format, which sphynx understands and has
an own formal specification in  http://docutils.sourceforge.net/rst.html
2019-10-13 21:09:24 +02:00
d413662b36 Adds ability to delete users in db as well as on the system + type hints..
.... in function names for further documentation.
2019-10-13 18:49:38 +02:00
a6d63fee42 PEP8: One Import per line... -.-
Add TODO statements and foremost return False on error. Missed that
2019-10-13 17:54:24 +02:00
c43cad73fa Print Error messages to stderr instead of standard-out. Makes very much sense indeed! 2019-10-13 17:35:04 +02:00
89faf57b58 System: Still a lot @TODO here, but add it. Should(TM) work, but didn't
test it yet and also have to do a whole lot more. e.g. write out in dry-mode
which commands are getting to run in serious-mode but build up together
correctly in the correct order
2019-10-13 17:16:48 +02:00