A take home execise solution for BingHR.io
- PHP >= v7.4 (Tested on PHP 7.4.26)
- MySQL >= v5.7 (Tested on MySQL 5.7.36)
- Apache >= v2.4 (Tested on PHP 2.4.51)
- Composer >= v2.2 (Tested on Composer 2.2.9)
*Preferably: Install WAMP/XAMP, LAMP or MAMP for Windows, Linux or MAC respectively to get PHP, MySQL, and Apache setup on your system. (Tested on Wampserver 3.2.6)
- Clone the repo:
https://github.com/ifeekz/BingHR-Exercise.git
- Change to project directory:
cd BingHR-Exercise
- Run the following command to generate your environment variable file:
- WINDOWS OS:
copy .env.example .env
- Linux or MAC OS:
cp .env.example .env
- Setup the database credentials in the
.env
file:DB_CONNECTION=mysql
- the type of DB to use, (e.g.mysql
,sqlite
, etc.)DB_HOST=127.0.0.1
- your DB host nameDB_PORT=3306
- your DB portDB_DATABASE=binghr
- change the value to the name of your DBDB_USERNAME=root
- change the value to your DB usernameDB_PASSWORD=
- add your DB password of leave empty if not required
- Run the following commends:
composer install
- to install dependenciesphp artisan key:generate
- to generate application keyphp artisan migrate
- to run database migration filesphp artisan serve
- to start the application
- Finally, open the URL displayed on your terminal on the browser
Though the UI might applicable jus for the purpose of the test, however, for real life experience, the following observations can be deduced:
- The
title
of the page appearing on the already clustered header of the application - On the create user modal,
user roles (or groups)
listed asapplication module permissions
- The title of the page should rather be placed left of the
Add User
button, which I provided a place for in the solution - Assigning user permissions this way (selecting individual permissions when creating user) will rather become a vague when the application grows. I recommend using a role-based as well as granular permissions to handle access control (ACL) for users. In this case, you select a user role (already created) to a user when addning a user. (And can extend granular permissions to the user if need be using a different interface)
** Hence, because of observation No. 2
I couldn't go further to implement the permissions strategy as found in the UI/UX. Here are my reasons:
- The users list table clearly indicated what type a user is on
column 2
of the table. - But, on the add user modal, roles are been listed as system modules which are to be assigned
read/write/delete
permissions.
Aside using Vue.js to implement the CRUD opreations, I would have loved to do the following if I had extra time.
- Implement a content load like facebook, instagram, etc for the initial state of data loading using Vue.
- Add pagination to the user table list using Vue.
- Implement multiple delete of selected users.
- Using the
principle of least privilege
to implement the proposed role-based as well as granular permissions.