Access Control System
Access Control System
(22PC0CS11)
LAB PROJECT
SUBMITTED BY:
V PRASHANTH
23WJ1A05N5
CSE-4
SUBMITTED TO:
Ms . A . VISHALAKSHI
INTRODUCTION
OBJECTIVE :
Example:
In Windows and Linux systems, when a user creates a file, they can define
whether others can read, write, or execute it—showcasing DAC in action.
DAC is flexible and user-friendly but can be less secure in environments where
strict control is necessary, as users can unintentionally or maliciously grant
access to unauthorized individuals.
Benefits of RBAC:
• Simplified administration: Permissions are managed at the role level, not
individually for each user.
• Improved security: Reduces the risk of privilege escalation, where users
accumulate more access rights than needed.
• Easier updates: When a user’s responsibilities change, simply changing
their role updates their access accordingly.
RBAC is widely used in organizations to enforce the principle of least
privilege, ensuring users only have access necessary to perform their duties.
Benefits of ABAC:
• Fine-grained control: Offers more flexibility than RBAC or DAC.
• Context-aware access: Decisions adapt to changing conditions, improving
security.
• Scalability: Ideal for complex systems with many users, resources, and
dynamic conditions.
ABAC is commonly used in cloud services, enterprise systems, and
applications requiring context-sensitive security and flexible policy
enforcement.
A C C ES S C O N T R O L S Y S T E M C O D E I N C
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_USERS 20
#define MAX_GROUPS 10
#define MAX_FILES 50
} User;
typedef struct {
} File;
} AccessLog;
// Global arrays
AccessLog logs[MAX_LOGS];
int log_count = 0;
void add_user();
void add_user_to_group();
void list_files();
void check_access();
void show_logs();
void add_user() {
char username[20];
strcpy(users[user_count].username, username);
users[user_count].group_count = 0; user_count++;
void add_user_to_group() {
if (strcmp(users[i].username, username) == 0) {
strcpy(users[i].groups[users[i].group_count], groupname);
users[i].group_count++;
return;
} }
scanf("%s", name);
void list_files() {
printf("\n%-25s %-10s %-10s %-10s %-5s\n", "Name", "Owner", "Group", "Perms", "Type");
} printf("\n");
if (strcmp(users[i].username, username) == 0) {
if (strcmp(users[i].groups[j], groupname) == 0)
return 1;
} } }
return 0;
log_count++;
void check_access() {
if (strcmp(files[i].name, filename) == 0) {
int index;
else {
printf("Invalid operation.\n");
return;
if (strcmp(files[i].owner, username) == 0) {
if (perm[index] == op_char) {
return;
} }
if (perm[index + 3] == op_char) {
return;
}}
else {
if (perm[index + 6] == op_char) {
return;
} }
printf("Access Denied.\n");
return;
} }
void show_logs() {
printf("\n");
int main() {
int choice;
while (1) {
switch (choice) {
} }
return 0;
}
OUTPUT: