-
Notifications
You must be signed in to change notification settings - Fork 0
user.LocalUser
Peter edited this page Aug 23, 2024
·
2 revisions
PeterOS User object. No public constructor.
Create a new LocalUser with name, password, and permissions.
Warning
CAN RETURN nil
if another user with name exits.
-
name: string
- Username -
pass: string
- Plain-text password -
perm: string|table
- Permissions (if string, placed in table)
Variable | Description |
---|---|
name: string |
User name |
pasH: string |
Hashed password (SHA-256) |
perm: nil|{string: boolean} |
FILE ONLY permission dictionary |
_perm: {string: boolean} |
PROTECTED User permissions |
Signature | Return | Description |
---|---|---|
() |
LocalUser? |
Constructor |
__init__(name, pass, perm) |
nil |
PACKAGE |
fromFile(name) |
LocalUser? |
Create a new User from file |
save() |
boolean |
Save user to file |
hasPerm(perm) |
boolean |
Check if user has permission node, or parent |
setPerm(perm, value) |
boolean |
Set permission node for user |
getHomeDir() |
string |
Get user's home directory: /home/username/
|
checkPass(pass) |
boolean |
Check password |
setPass(oldPass, newPass) |
boolean |
Set the user's password |
Queue:__init__(name: string, pass: string, perms: {string: boolean}): nil
PACKAGE
Initialize a new LocalUser
-
name: string
- Username -
pass: string
- Plain-text password -
perms: {string: boolean}
- Permission tree
Queue:fromFile(name: string): LocalUser?
Create a new User from file
-
name: string
- Username
user: LocalUser?
Queue:save(): boolean
Save user to file
saved: boolean
Queue:hasPerm(perm: string): boolean
Check if user has permission node, or parent
-
perm: string
- Permission node
-
hasPerm: boolean
- Description
Queue:setPerm(perm: string, value: true|false|nil): boolean
Set permission node for user
-
perm: string
- Permission node -
value: true|false|nil
- Permission status.true
for has,false
for block,nil
to unset
-
saved: boolean
- If the change could be saved
Queue:getHomeDir(): string
Get user's home directory: /home/username/
homeDir: string
Queue:checkPass(pass: string): boolean
Check password
-
pass: string
- Password to check
valid: boolean
Queue:setPass(oldPass: string, newPass: string): boolean
Set the user's password
-
oldPass: string
- Current password -
newPass: string
- New password
set: boolean