summaryrefslogtreecommitdiffhomepage
path: root/Kernel/KernelKit
diff options
context:
space:
mode:
authorAmlal <amlal@zka.com>2024-07-23 12:02:10 +0200
committerAmlal <amlal@zka.com>2024-07-23 12:02:10 +0200
commit274cba18b8f1c255ddcff2f5c14aab4d0c846820 (patch)
treeaa56d2223c79d447b85a2bfefdbaab90b25fc8fe /Kernel/KernelKit
parent8eee31685e4334415870bb00b11b6b0d29821f10 (diff)
[IMP] User class and current user global.
[REMOVE] ApplicationInterface struct. [IMP] DDK_STATUS_STRUCT data structure for driver events. Signed-off-by: Amlal <amlal@zka.com>
Diffstat (limited to 'Kernel/KernelKit')
-rw-r--r--Kernel/KernelKit/PermissionSelector.hxx57
-rw-r--r--Kernel/KernelKit/ProcessScheduler.hxx2
-rw-r--r--Kernel/KernelKit/User.hxx65
3 files changed, 66 insertions, 58 deletions
diff --git a/Kernel/KernelKit/PermissionSelector.hxx b/Kernel/KernelKit/PermissionSelector.hxx
deleted file mode 100644
index 309e260a..00000000
--- a/Kernel/KernelKit/PermissionSelector.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies
-
-------------------------------------------- */
-
-#ifndef _INC_PERMISSION_SEL_HXX_
-#define _INC_PERMISSION_SEL_HXX_
-
-#include <CompilerKit/CompilerKit.hxx>
-#include <NewKit/Defines.hpp>
-
-// super admin mode user.
-#define kMachineUser "Machine"
-
-// user mode users.
-#define kSuperUser "Admin"
-#define kGuestUser "Guest"
-
-// hash 'user@host:password' -> base64 encoded data
-// use this data to then fetch specific data.
-
-namespace Kernel
-{
- enum class RingKind
- {
- kRingUser = 3,
- kRingDriver = 2,
- kRingKernel = 0,
- kRingUnknown = -1,
- kRingCount = 4,
- };
-
- class PermissionSelector final
- {
- private:
- explicit PermissionSelector(const Int32& sel);
- explicit PermissionSelector(const RingKind& kind);
-
- ~PermissionSelector();
-
- public:
- NEWOS_COPY_DEFAULT(PermissionSelector)
-
- public:
- bool operator==(const PermissionSelector& lhs);
- bool operator!=(const PermissionSelector& lhs);
-
- public:
- const RingKind& Ring() noexcept;
-
- private:
- RingKind fRing;
- };
-} // namespace Kernel
-
-#endif /* ifndef _INC_PERMISSION_SEL_HXX_ */
diff --git a/Kernel/KernelKit/ProcessScheduler.hxx b/Kernel/KernelKit/ProcessScheduler.hxx
index e5368201..4f9f99f6 100644
--- a/Kernel/KernelKit/ProcessScheduler.hxx
+++ b/Kernel/KernelKit/ProcessScheduler.hxx
@@ -9,7 +9,7 @@
#include <ArchKit/ArchKit.hpp>
#include <KernelKit/LockDelegate.hpp>
-#include <KernelKit/PermissionSelector.hxx>
+#include <KernelKit/User.hxx>
#include <KernelKit/ProcessHeap.hxx>
#include <NewKit/MutableArray.hpp>
diff --git a/Kernel/KernelKit/User.hxx b/Kernel/KernelKit/User.hxx
new file mode 100644
index 00000000..aa0901ac
--- /dev/null
+++ b/Kernel/KernelKit/User.hxx
@@ -0,0 +1,65 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies
+
+------------------------------------------- */
+
+#ifndef _INC_PERMISSION_SEL_HXX_
+#define _INC_PERMISSION_SEL_HXX_
+
+#include <CompilerKit/CompilerKit.hxx>
+#include <NewKit/String.hpp>
+#include <NewKit/Defines.hpp>
+
+// user mode users.
+#define kSuperUser "Admin"
+#define kGuestUser "Guest"
+
+#define kUsersDir "\\Users\\Store\\"
+
+#define kMaxUserNameLen (255)
+
+// hash 'password' -> base64+md5 encoded data
+// use this data to then fetch specific data of the user..
+
+namespace Kernel
+{
+ enum class RingKind
+ {
+ kRingStdUser = 1,
+ kRingSuperUser = 2,
+ kRingGuestUser = 5,
+ kRingCount = 5,
+ };
+
+ class User final
+ {
+ public:
+ explicit User() = default;
+
+ User(const Int32& sel, const Char* userName);
+ User(const RingKind& kind, const Char* userName);
+
+ ~User();
+
+ public:
+ NEWOS_COPY_DEFAULT(User)
+
+ public:
+ bool operator==(const User& lhs);
+ bool operator!=(const User& lhs);
+
+ public:
+ const RingKind& Ring() noexcept;
+ const StringView Name() noexcept;
+
+ private:
+ RingKind fRing{RingKind::kRingStdUser};
+ StringView fUserName{kMaxUserNameLen};
+
+ };
+
+ inline User* cRootUser = nullptr;
+} // namespace Kernel
+
+#endif /* ifndef _INC_PERMISSION_SEL_HXX_ */