forked from abidh8820/Regional-Traffic-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
role.h
97 lines (91 loc) · 2.16 KB
/
role.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "bits/stdc++.h"
using namespace std;
class Role
{
private:
bool AccessToViewPersonal;
bool AccessToViewOthers;
bool AccessToDelete;
bool AccessToUpdate;
public:
Role()
{
AccessToViewPersonal=false;
AccessToUpdate=false;
AccessToDelete=false;
AccessToViewOthers=false;
}
void GivePermissions(string role)
{
if(role=="User")
{
AccessToViewPersonal=true;
}
else if(role=="police" || role=="Government Worker")
{
AccessToViewPersonal=true;
AccessToViewOthers=true;
}
else if(role=="admin")
{
AccessToViewPersonal=true;
AccessToViewOthers=true;
AccessToDelete=true;
AccessToUpdate=true;
}
else
{
cout<<"Unknown Role"<<endl;
}
}
/*void CheckPermission()
{
if(!AccessToView)
{
cout<<"You don't have permission to view the database system."<<endl;
}
if(!AccessToQuery)
{
cout<<"You don't have permission to make query"<<endl;
}
if(!AccessToUpdate)
{
cout<<"You don't have permission to update any database entry"<<endl;
}
if(!AccessToDelete)
{
cout<<"You don't have permission to delete any query"<<endl;
}
}*/
bool viewPersonal(){
if(!AccessToViewPersonal)
{
cout<<"You don't have permission to view the database system."<<endl;
}
return AccessToViewPersonal;
}
bool viewOthers(){
if(!AccessToViewOthers)
{
cout<<"You don't have permission to view Others int the database system."<<endl;
}
return AccessToViewOthers;
}
bool deleteInfo(){
if(!AccessToDelete)
{
cout<<"You don't have permission to delete any query."<<endl;
}
return AccessToDelete;
}
bool updateInfo(){
if(!AccessToUpdate)
{
cout<<"You don't have permission to update any database entry."<<endl;
}
return AccessToUpdate;
}
~Role()
{
}
};