Skip to content

💼 CLI for Kakitangan app, the online HR Software for Malaysian businesses

Notifications You must be signed in to change notification settings

mdminhazulhaque/kakitangan-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kakitangan is an online HR Software for Malaysian businesses that helps handle payroll, claims, benefits, leave and more.

You can easily use the web version, or if you prefer, they have both Android and iOS version too.

Why CLI Version?

You can ask me why I made this CLI version although they have a nice web and mobile version. Well, people like me prefer CLI than GUI. Also, I wanted to learn how Python module works. So I decided to turn this into a pet project.

Who Can Be Benefited From This

  • If you are a project manager and need to frequently check who is on leave next week
  • If you are a manager, you can get details who are on leave on a specific day before arranging any session
  • If you are a simple developer, you can sniff on your colleagues and surprise them
  • If you are a human resource person, you can get statistics on who makes the best use leave policies

Requirments

As written in Python3, the following modules are needed. Install using pip3 install -r requirments.txt

  • appdirs
  • click
  • tabulate

Security?

I know. I know. You are damn worried about the security of your Kakitangan account. At least I am not going to store your password in plaintext as Google or Facebook did. This CLI app asks for your password once, tries to get an authorization token from Kakitangan API and ONLY saves the following things on your disk. It even asks for your password via stdin and hides the prompt so no trace is left in your bash history.

  • username
  • sessionid
  • authorizationtoken
  • csrftoken

There is no way to get your password recovered from these 4 values.

FAQ

There is no way to get your pa* How does this app work? * The same way Kakitangan's web app works, using GET and POST requests to their API endpoints. Most of then return JSON so I did not have to use parse HTML.

  • Is there any API documentation for Kakitangan?
    • AFAIK, no. I had to trace their API calls via Chrome DevTools and figured out by myself how they work.
  • Is this CLI app safe to use?
    • This app saves nothing but the sessionid and authorizationtoken, same as your web browser does. It never stores the password.
  • My question is not answered.
    • Send me an email or post a new issue in this repository.

How To Use It?

I am currently working to distribute this via setuptools. Before that, you can download the repo and execute the kakitangan.py as the main file. The default commands are given below.

$ kakitangan.py --help
Usage: kakitangan.py [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  aboutme      Shows personal information as Kakitangan user
  colleagues   Shows colleagues' leaves
  holidays     Shows holidays
  loadleaves   Fetches all calendar information from Kakitangan server
  login        Login and save authorization token in disk
  logout       Logs out by clearing authorization token from disk
  myleaves     Shows user's leaves
  myleavestat  The user's leave statistics

First, you have to log in, right? You have to pass the username/email via -u option. The password will be prompted and will be invisible as you type it. The password can also be passed via -p option but I tell you not to do so. Your password will be stored in .bash_history which would be a serious security issue.

$ kakitangan.py login -u [email protected]
Password: **********
Login success

$ kakitangan.py login -u [email protected] -p 1234567890
Login success

If your password is correct and you have an internet connection, you are supposed to see the Login success message. Use the aboutme option to see your basic info.

$ kakitangan.py aboutme
---------------------  -------------------------------
Email                  [email protected]
Official Full Name     John Doe
Nationality            Bangladesh
Highest Qualification  Bachelors Degree
SOCSO Account          1234567890
Bank Account           1234567890
Bank Account Type      saving
Bank Account Name      AABBCCDD
Income Tax Account     1234567890
Salary                 1234567890
Preferred Name         John
Sex                    Male
Marital Status         married
Active                 True
Birth Date             1994-01-23
Phone                  1234567890
NRIC Number            1234567890
Passport Number        BB12345678
Employee ID            1000
Joined                 1970-01-01
Manager                [email protected]
Position               DevOps
Department             Tech
Location               Kuala Lumpur
---------------------  -------------------------------

That's enough for you I guess. Let's move to the leave calendar which is the best feature of Kakitangan. Before executing any calendar related command, you have to download the full calendar from Kakitangan server. loadleaves option will do it for you.

$ kakitangan.py loadleaves
Updated leave database

After doing so, you will find 3 new JSON files in ~/.config/kakitangan-cli named load_calendar.json, load_colleagues.json and load_holiday_event.json. This 3 calendar holds data for yourself, your colleagues, and holidays respectively.

Now you are ready to get your colleagues' leave summary. The colleagues command takes several parameters.

Usage: kakitangan.py colleagues [OPTIONS]

  Shows colleagues' leaves

Options:
  -a, --all          Show past leaves also
  -t, --today        Show leaves only on today
  -u, --untill TEXT  Show leaves upto date
  -s, --since TEXT   Show leaves from date
  -d, --date TEXT    Show leaves on specific date
  --help             Show this message and exit.

By default, it will show leaves AFTER the current date. You can see all leaves with -a parameter.

$ kakitangan.py colleagues
----------  --------------
2019-06-03  Abdul Doe (Annual)
            Alice Begum (Marriage Leave)
2019-06-04  Abdul Doe (CarryForward)
            Charlie Ahmed (Annual)
            Foo Bin Bar (Annual)
            Alice Begum (Sick)
2019-06-10  Foo Bin Bar (Sick)
            Bob Mia (Birthday Leave)
2019-06-11  Bob Mia (Sick)
2019-06-12  Bob Mia (Sick)
2019-06-13  Bob Mia (Annual)
2019-06-14  Clara Khatun (Annual)
            Bob Mia (Annual)
2019-06-15  Clara Khatun (CarryForward)
2019-06-16  Clara Khatun (CarryForward)
2019-06-17  Clara Khatun (Annual)
            Bob Mia (Replacement)
2019-06-18  Bob Mia (Annual)
----------  --------------

It is possible to see who are on leave on a specific date. Just pass the date in YYYY-MM-DD format with -d parameter.

$ kakitangan.py colleagues -d 2019-06-10
----------  -----------
2019-06-10  Foo Bin Bar (Sick)
            Bob Mia (Birthday Leave)
----------  -----------

You might want to filter colleagues within specific date range. Just use the -s (since) and -u (until) parameter.

$ kakitangan.py colleagues -s 2019-06-15 -u 2019-06-17
----------  ------------
2019-06-15  Clara Khatun (Annual)
2019-06-16  Clara Khatun (Annual)
2019-06-17  Clara Khatun (Annual)
            Bob Mia (Annual)
----------  ------------

Similar to the leave calendar, you can check your holidays too. Use the holidays option for this purpose.

$ kakitangan.py holidays 
----------  ----------------------------
2019-06-05  Hari Raya Aidilfitri
2019-06-06  Hari Raya Aidilfitri Holiday
2019-08-11  Hari Raya Haji
2019-08-12  Hari Raya Haji
2019-08-31  Merdeka Day
2019-09-01  Awal Muharram
2019-09-02  Awal Muharram
2019-09-09  Agong's Birthday
2019-09-16  Malaysia Day
2019-10-27  Deepavali
2019-10-28  Deepavali
2019-11-09  Prophet Muhammad's birthday
2019-12-25  Christmas
----------  ----------------------------

As I said earlier, filtering hides old leaves/events. So you have to pass -a to see full holiday list.

$ kakitangan.py holidays -a
----------  ---------------------------------------------------------
2015-01-01  New Year
2015-01-02  New Year
2015-01-03  New Year
...
2017-06-25  Hari Raya Aidilfitri
2017-06-26  Hari Raya Aidilfitri
2017-06-27  Hari Raya Aidilfitri
...
2019-10-27  Deepavali
2019-10-28  Deepavali
2019-11-09  Prophet Muhammad's birthday
2019-12-25  Christmas
----------  ---------------------------------------------------------

Okay, you want to check your own leaves, right? You can! Use myleaves with -a parameter if you want to see the old leaves too.

$ kakitangan.py myleaves -a
----------  -----------
2019-02-28  Sick
2019-03-12  Sick
2019-03-21  Annual
2019-05-17  Annual (PM)
2019-05-21  Annual
2019-05-22  Annual
2019-05-23  Annual
2019-05-24  Annual
----------  -----------

If you need to know your leave statistics, I have added a command named myleavestat.

$ kakitangan.py myleavestat
-----------------------  -----------------
Compassionate            10/10
Annual                   25/50 (25 used)
Sick                     15/30 (15 used)
Paternity                10/10
Hospitalization          30/60 (30 used)
Replacement              1/1
Birthday Leave           1/1
Annual Leave Additional  5/5
CarryForward             5/5
Unpaid Leave             10/10
Bonus Leave              1/1
Exam/Study Leave         5/5
-----------------------  -----------------

Going back home? Don't want anyone to sneak into your Kakitangan account? You can log out anytime. It's easy.

$ kakitangan.py logout
Confirm logout? [Y/N]: Y
Logged out

TODO/BUGS

  • Show birthdays of colleagues
  • Cases, when the internet is down, is not handled yet
  • Need to add logging feature to track file read/write events
  • Need to add Apply for Leave feature
  • Need to improve loadleaves command (remove manual call)
  • You found one? Post as an issue or send PR.

About

💼 CLI for Kakitangan app, the online HR Software for Malaysian businesses

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages