summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/KernelKit/User.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-02 19:38:46 +0200
committerGitHub <noreply@github.com>2025-05-02 19:38:46 +0200
commit997be16e5ac9a68d54882ab69529815860d62955 (patch)
tree19d6129c2d776bb1edc5d4a7325e39ca176c3403 /dev/kernel/KernelKit/User.h
parent618104e74c195d7508a18450524f8ed7f9af8cc6 (diff)
parentb3b4b1ebdcd6adeac914869017c86d892b7a8ced (diff)
Merge pull request #28 from nekernel-org/dev
0.0.2
Diffstat (limited to 'dev/kernel/KernelKit/User.h')
-rw-r--r--dev/kernel/KernelKit/User.h95
1 files changed, 46 insertions, 49 deletions
diff --git a/dev/kernel/KernelKit/User.h b/dev/kernel/KernelKit/User.h
index a228c9f0..250b1dfc 100644
--- a/dev/kernel/KernelKit/User.h
+++ b/dev/kernel/KernelKit/User.h
@@ -17,79 +17,76 @@
#include <CompilerKit/CompilerKit.h>
#include <KernelKit/KPC.h>
-#include <NewKit/KString.h>
#include <NewKit/Defines.h>
+#include <NewKit/KString.h>
///! We got the Super, Standard (%s format) and Guest user,
///! all are used to make authorization operations on the OS.
#define kSuperUser "OS AUTHORITY/SUPER/%s"
#define kGuestUser "OS AUTHORITY/GUEST/%s"
-#define kStdUser "OS AUTHORITY/STD/%s"
+#define kStdUser "OS AUTHORITY/STD/%s"
#define kUsersDir "/user/"
-#define kMaxUserNameLen (256U)
+#define kMaxUserNameLen (256U)
#define kMaxUserTokenLen (256U)
-namespace Kernel
-{
- class User;
+namespace Kernel {
+class User;
- enum class UserRingKind
- {
- kRingInvalid = 0,
- kRingStdUser = 1,
- kRingSuperUser = 2,
- kRingGuestUser = 5,
- kRingCount = 3,
- };
+enum class UserRingKind {
+ kRingInvalid = 0,
+ kRingStdUser = 1,
+ kRingSuperUser = 2,
+ kRingGuestUser = 5,
+ kRingCount = 3,
+};
- typedef Char* UserPublicKey;
- typedef Char UserPublicKeyType;
+typedef Char* UserPublicKey;
+typedef Char UserPublicKeyType;
- /// @brief User class.
- class User final
- {
- public:
- User() = delete;
+/// @brief User class.
+class User final {
+ public:
+ User() = delete;
- User(const Int32& sel, const Char* username);
- User(const UserRingKind& kind, const Char* username);
+ User(const Int32& sel, const Char* username);
+ User(const UserRingKind& kind, const Char* username);
- ~User();
+ ~User();
- public:
- NE_COPY_DEFAULT(User)
+ public:
+ NE_COPY_DEFAULT(User)
- public:
- bool operator==(const User& lhs);
- bool operator!=(const User& lhs);
+ public:
+ bool operator==(const User& lhs);
+ bool operator!=(const User& lhs);
- public:
- /// @brief Get software ring
- const UserRingKind& Ring() noexcept;
+ public:
+ /// @brief Get software ring
+ const UserRingKind& Ring() noexcept;
- /// @brief Get user name
- Char* Name() noexcept;
+ /// @brief Get user name
+ Char* Name() noexcept;
- /// @brief Is he a standard user?
- Bool IsStdUser() noexcept;
+ /// @brief Is he a standard user?
+ Bool IsStdUser() noexcept;
- /// @brief Is she a super user?
- Bool IsSuperUser() 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 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 Matches(const UserPublicKey password) noexcept;
+ /// @brief Checks if a password matches the **password**.
+ /// @param password the password to check.
+ Bool Matches(const UserPublicKey password) noexcept;
- private:
- UserRingKind mUserRing{UserRingKind::kRingStdUser};
- Char mUserName[kMaxUserNameLen] = {0};
- Char mUserKey[kMaxUserTokenLen] = {0};
- };
-} // namespace Kernel
+ private:
+ UserRingKind mUserRing{UserRingKind::kRingStdUser};
+ Char mUserName[kMaxUserNameLen] = {0};
+ Char mUserKey[kMaxUserTokenLen] = {0};
+};
+} // namespace Kernel
#endif /* ifndef INC_USER_H */