diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 03:02:43 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 03:02:43 +0100 |
| commit | 83d870e58457a1d335a1d9b9966a6a1887cc297b (patch) | |
| tree | 72888f88c7728c82f3f6df1f4f70591de15eab36 /dev/kernel/KernelKit/UserMgr.h | |
| parent | ab37adbacf0f33845804c788b39680cd754752a8 (diff) | |
feat! breaking changes on kernel sources.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/kernel/KernelKit/UserMgr.h')
| -rw-r--r-- | dev/kernel/KernelKit/UserMgr.h | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/dev/kernel/KernelKit/UserMgr.h b/dev/kernel/KernelKit/UserMgr.h deleted file mode 100644 index 3ce6254d..00000000 --- a/dev/kernel/KernelKit/UserMgr.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ======================================== - - Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license. - -======================================== */ - -#ifndef INC_USER_H -#define INC_USER_H - -/* ======================================== - - Revision History: - - 04/03/25: Set users directory as /libSystem/ instead of /usr/ - - ======================================== */ - -#include <CompilerKit/CompilerKit.h> -#include <KernelKit/KPC.h> -#include <NeKit/Defines.h> -#include <NeKit/KString.h> - -///! We got the MGMT, STD (%s format) and GUEST users, -///! all are used to make authorized operations. -#define kMgmtUser "NEKERNEL/MGMT/%s" -#define kGuestUser "NEKERNEL/GUEST/%s" -#define kStdUser "NEKERNEL/STD/%s" - -#define kUsersDir "/users/" - -#define kMaxUserNameLen (256U) -#define kMaxUserTokenLen (256U) - -namespace Kernel { -class User; - -enum class UserRingKind : Int32 { - kRingInvalid = 0, - kRingStdUser = 444, - kRingSuperUser = 666, - kRingGuestUser = 777, - kRingCount = 3, -}; - -typedef Char* UserPublicKey; -typedef Char UserPublicKeyType; - -/// @brief System User class. -class User final { - public: - User() = delete; - - User(const Int32& sel, const Char* username); - User(const UserRingKind& kind, const Char* username); - - ~User(); - - public: - NE_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 UserPublicKey password) noexcept; - - /// @brief Checks if a password matches the **password**. - /// @param password the password to check. - Bool Login(const UserPublicKey password) noexcept; - - private: - UserRingKind mUserRing{UserRingKind::kRingStdUser}; - Char mUserName[kMaxUserNameLen] = {0}; - UInt64 mUserFNV{0UL}; -}; - -inline User* kCurrentUser = nullptr; -inline User* kRootUser = nullptr; -} // namespace Kernel - -#endif /* ifndef INC_USER_H */ |
