Build a Bitwise Permission System

Jannis Milz
3 min readJan 13, 2024

Non-members of medium can read here

Permissions are everywhere, and very important to secure your application from unauthorized actions and potential data loss. A system to handle and combine permissions can be overwhelming and maybe too complex, but there’s a better way called 🔐 Bitwise Permission System!

🛠 How to build your own

I will be doing this in JavaScript, but the system is pretty much in every language possible.

Operators

Let’s quickly discuss the bitwise operators. I’ll give you a small overview here.

Bits is the unit 0 or 1. It's the smallest unit of data a computer can process and store. For example you can convert the number 3 into bits which would be 110. I'm not going any deeper on bits, there's a lot of resources in the internet.

We are going to build a small project to check if a person is allowed to enter different areas in our headquarter.

--

--

Jannis Milz

An always-wanting-to-learn-more person. Developer advocate. Obsessed with self-improvement and efficiency.