Dimas Maulana

Dimas Maulana

Developer

Welcome to my website! I am a developer with a current focus on React and Go. My experience encompasses both front-end and back-end development, enabling me to design and develop seamless and efficient applications.

User Roles Naming

Effective user role naming is essential for managing access control and permissions in systems, applications, and organizations. Well-structured role names enhance clarity, consistency, scalability, and security, ensuring that responsibilities and access levels are accurately represented.

Key Principles

  1. Clarity – Role names should be self-explanatory and easily understood by all stakeholders.
  2. Consistency – Maintain uniform naming conventions across all roles to prevent confusion.
  3. Scalability – Design role names that accommodate future expansions or modifications.
  4. Security – Ensure that role names reflect the appropriate access levels without exposing sensitive information.

Example Role Hierarchy

flowchart LR
a[Site Visitor] --> b[Former Member]
a --> c[Registered Member]
a --> d[Known Visitor]
a --> e[Unknown Visitor]
c --> f[Premium Member]
c --> g[Trial Member]

Explanation

  • Site Visitor: A general user without an account.
  • Former Member: A user who previously had an account but is now inactive.
  • Registered Member: An active user with a registered account.
    • Premium Member: A user with a paid or upgraded membership.
    • Trial Member: A user on a temporary trial plan.
  • Known Visitor: A non-registered user recognized through tracking mechanisms.
  • Unknown Visitor: A completely anonymous user.

Conclusion

Adopting structured and meaningful role names improves system usability, security, and scalability. Organizations should define roles carefully to align with business needs while maintaining clear distinctions in access levels.

How to Get Yesterday's Date in Bash on Mac and Ubuntu

In Bash scripting, there are various ways to retrieve yesterday’s date on both Mac and Ubuntu systems. Below, we’ll demonstrate two different methods for each operating system.

Mac:

Method 1: Using date with -v option

1
2
yesterday=$(date -v-1d +%F)
echo "Yesterday's date on Mac: $yesterday"

In this method, we use the -v option with the date command to subtract 1 day from the current date and format it as %F, which gives the date in YYYY-MM-DD format.

Shell Bash Export Variable

It looks like you’re trying to use the eval command in a Bash script to export variables loaded from a dotenv file using the shdotenv tool. This is a common practice for setting environment variables from a configuration file. Here’s an explanation of what this code does:

  1. shdotenv is likely a command or script that reads a dotenv file (usually named .env) and sets environment variables based on the key-value pairs defined in that file. Dotenv files are commonly used to store configuration variables for applications.

Golang Interface{} and Type Assertions

In Go (Golang), the interface{} type is an empty interface that can hold values of any type. It is often used when you need to work with values of unknown or varied types. Type assertions allow you to extract and work with the underlying concrete type of a value stored in an interface{}. Here, we’ll explore how to use interface{} and type assertions in Go.

Storing Different Types in an interface{}

You can store values of different types in an interface{}. Here’s an example:

REST API Status Code Example

Introduction

HTTP status codes are essential in REST APIs as they indicate the outcome of client requests. These standardized codes help clients understand whether their request was successful, requires further action, or encountered an error. Below is an overview of key HTTP status codes categorized by their respective classes.

REST API Success Response Example

Overview

This document provides an example of a successful response from a REST API when creating a new resource. The response follows a structured format, including essential details such as the resource ID, attributes, timestamps, and metadata.

0%