admin module

class admin.admin

Bases: object

This is a class manages the users who use the system and also allows user to be created, check if the user exists, check the users password

check(name, password)

checks if the user is registered user, does this by checking if they’re name and password is in the textfile.The name should also match the corresponding password.

Parameters
  • name (string) – This is the name the user uses to login

  • password (string) – This is the password the user will uses to login.

Returns

Returns True if the user was successfuly validated and False if the user was not successfuly validated.

Return type

bool

checkAdmin(password)

Function that checks if a user is an admin

Parameters
  • username (string) – The username the user uses to log in

  • password (string) – The password the user uses to log in

Returns

Returns true if the user is an admin

Return type

Returns false if the user is not an admin

checkPassword(name)

Takes in a username and returns the corresponding password to the username

Parameters

name (string) – This is the name the user uses to login.

Returns

splitList[0] which is the password of the user or Not found (str): Returns a Not found string if the corresponding username is not registered

Return type

string

createUser(name, password)

Writes the name and password of the user in a textfile in a newline

Parameters
  • name (string) – This is the name the user will use to login.

  • password (string) – This is the password the user uses to sign in

deleteUser(password)

Functions that deletes a registered user from the list of registered users

Parameters
  • username (string) – The username the individual uses to log in

  • password (String) – The password the user uses to log in

makeAdmin(password)

Function that takes the username and password of a user and makes them an admin

Parameters
  • username (string) – The username the individual will uses to login

  • password (string) – The password the individual uses to login