summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/KernelKit/User.h
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:13 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:45 +0100
commit610f91d87152cbe48d3054fcf437d8239da6ef35 (patch)
treea386f7047ab73d088169ab2371ddc6ffe8020f1c /dev/Kernel/KernelKit/User.h
parent509fcca5986651c8ba712fb395f8498f2dea4109 (diff)
IMP: :boom: Breaking changes some checks are needed to be done.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/KernelKit/User.h')
-rw-r--r--dev/Kernel/KernelKit/User.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/dev/Kernel/KernelKit/User.h b/dev/Kernel/KernelKit/User.h
new file mode 100644
index 00000000..be911830
--- /dev/null
+++ b/dev/Kernel/KernelKit/User.h
@@ -0,0 +1,83 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, TQ B.V, all rights reserved.
+
+------------------------------------------- */
+
+#ifndef INC_USER_H
+#define INC_USER_H
+
+#include <CompilerKit/CompilerKit.h>
+#include <KernelKit/LPC.h>
+#include <NewKit/KString.h>
+#include <NewKit/Defines.h>
+
+///! We got the Super and guest user, both used to make authorization operations on the OS.
+#define kSuperUser "OS AUTHORITY/SUPER"
+#define kGuestUser "OS AUTHORITY/GUEST"
+
+#define kUsersDir "/Users/"
+
+#define kMaxUserNameLen (255U)
+#define kMaxUserTokenLen (255U)
+
+namespace Kernel
+{
+ class User;
+
+ enum class UserRingKind
+ {
+ kRingInvalid = 0,
+ kRingStdUser = 1,
+ kRingSuperUser = 2,
+ kRingGuestUser = 5,
+ kRingCount = 3,
+ };
+
+ typedef Char* usr_public_key_kind;
+
+ class User final
+ {
+ public:
+ explicit User() = delete;
+
+ User(const Int32& sel, const Char* userName);
+ User(const UserRingKind& kind, const Char* userName);
+
+ ~User();
+
+ public:
+ ZKA_COPY_DEFAULT(User)
+
+ public:
+ bool operator==(const User& lhs);
+ bool operator!=(const User& lhs);
+
+ public:
+ /// @brief Get software ring
+ const UserRingKind& Ring() noexcept;
+
+ /// @brief Get user name
+ Char* Name() noexcept;
+
+ /// @brief Is he a standard user?
+ Bool IsStdUser() noexcept;
+
+ /// @brief Is she a super user?
+ Bool IsSuperUser() noexcept;
+
+ /// @brief Saves a password from the public key.
+ Bool Save(const usr_public_key_kind password) noexcept;
+
+ /// @brief Checks if a password matches the **password**.
+ /// @param password the password to check.
+ Bool Matches(const usr_public_key_kind password) noexcept;
+
+ private:
+ UserRingKind mUserRing{UserRingKind::kRingStdUser};
+ Char mUserName[kMaxUserNameLen] = {0};
+ Char mUserToken[kMaxUserTokenLen] = {0};
+ };
+} // namespace Kernel
+
+#endif /* ifndef INC_USER_H */