Skip to content

Commit 40e9a37

Browse files
authored
refactor: site registration moved, removed dormant husky dir, bumped pre-commit version
User is already being registered at Access.admin so commented out the registration of User in bootprocess.admin adding pytest_bdd in requirements upgrading pre-commit modules version removed dormant husky dir
1 parent e5e1eec commit 40e9a37

File tree

11 files changed

+34
-103
lines changed

11 files changed

+34
-103
lines changed

.husky/commit-msg

Lines changed: 0 additions & 4 deletions
This file was deleted.

.pre-commit-config-gh-action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ repos:
1919
files: \.(json|json.sample)$
2020
args: [--autofix, --no-sort-keys]
2121
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
22-
rev: v2.5.0
22+
rev: v2.6.0
2323
hooks:
2424
- id: pretty-format-yaml
2525
args: [--autofix]

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ repos:
1919
files: \.(json|json.sample)$
2020
args: [--autofix, --no-sort-keys]
2121
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
22-
rev: v2.5.0
22+
rev: v2.6.0
2323
hooks:
2424
- id: pretty-format-yaml
2525
args: [--autofix]
2626
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
27-
rev: v9.3.0
27+
rev: v9.4.0
2828
hooks:
2929
- id: commitlint

Access/admin.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
from django.contrib import admin
2-
from Access.models import User
2+
3+
from Access.models import (
4+
User,
5+
Permission,
6+
UserAccessMapping,
7+
Role,
8+
AccessV2,
9+
GroupV2,
10+
MembershipV2,
11+
GroupAccessMapping
12+
)
313

414

515
class UserAdmin(admin.ModelAdmin):
@@ -9,3 +19,10 @@ class UserAdmin(admin.ModelAdmin):
919

1020

1121
admin.site.register(User, UserAdmin)
22+
admin.site.register(Permission)
23+
admin.site.register(UserAccessMapping)
24+
admin.site.register(Role)
25+
admin.site.register(AccessV2)
26+
admin.site.register(GroupV2)
27+
admin.site.register(MembershipV2)
28+
admin.site.register(GroupAccessMapping)

Access/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def is_allowed_admin_actions_on_group(self, group):
208208

209209
def is_allowed_to_offboard_user_from_group(self, group):
210210
return group.member_is_owner(self) or self.has_permission("ALLOW_USER_OFFBOARD")
211-
211+
212212
def create_new_identity(self, access_tag="", identity=""):
213213
return self.module_identity.create(access_tag=access_tag, identity=identity)
214214

Access/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def saveIdentity(request):
7474
context["error"] = {
7575
"title": NEW_IDENTITY_CREATE_ERROR_MESSAGE["title"],
7676
"msg": NEW_IDENTITY_CREATE_ERROR_MESSAGE["msg"].format(modulename = modname),
77-
}
77+
}
7878
return JsonResponse(json.dumps(context), safe=False, status=400)
7979

8080
@login_required

README.md

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -64,69 +64,6 @@ Docker should be running for linter tool:
6464
docker exec dev make lint
6565
```
6666

67-
### Pre-requisistes
68-
69-
- Install Docker
70-
```bash
71-
brew install docker docker-compose
72-
```
73-
74-
- Install Docker Container Runtime
75-
https://github.com/abiosoft/colima
76-
```bash
77-
brew install colima
78-
colima start
79-
```
80-
81-
### Setup
82-
83-
1. Create .env file from .env.sample file. Edit the DOCKERIMAGE to the latest image URL.
84-
85-
2. Start the service
86-
```bash
87-
make dev
88-
```
89-
3. Check logs with
90-
```bash
91-
make logs
92-
```
93-
4. After seeing migration output in the logs (or waiting a minute after the containers come up),
94-
create superuser with
95-
```bash
96-
# Access the container with:
97-
docker exec -it dev bash
98-
#In the container:
99-
python manage.py createsuperuser
100-
# Set email to your email id, and password to anything you want
101-
```
102-
5. Access the db container with below commands. Password for db container is testtest
103-
```bash
104-
docker exec -it db bash
105-
mysql -u root -p
106-
create database enigma;
107-
```
108-
6. Restart the server by runing below commands
109-
```bash
110-
docker-compose -f docker-compose.yml restart
111-
```
112-
Enigma should be up and running on port 8000!
113-
- Login at localhost:8000/admin
114-
- Login here with your superuser credentials, and click the View Site button on the top right after logging in.
115-
116-
### How to run tests
117-
118-
1. Tests:
119-
If Web service is not running, the command will first load up the service and then run the tests.
120-
```bash
121-
make test
122-
```
123-
124-
2. Linter:
125-
Docker should be running for linter tool:
126-
```bash
127-
docker exec dev make lint
128-
```
129-
13067
### For contributing code
13168

13269
- Python 3.11.0

bootprocess/admin.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +0,0 @@
1-
from django.contrib import admin
2-
3-
from Access.models import (
4-
User,
5-
Permission,
6-
UserAccessMapping,
7-
Role,
8-
AccessV2,
9-
GroupV2,
10-
MembershipV2,
11-
GroupAccessMapping
12-
)
13-
14-
admin.site.register(Permission)
15-
admin.site.register(UserAccessMapping)
16-
admin.site.register(Role)
17-
admin.site.register(AccessV2)
18-
admin.site.register(GroupV2)
19-
admin.site.register(MembershipV2)
20-
admin.site.register(GroupAccessMapping)

bootprocess/views_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def getDashboardData(request):
7979
ec2_regions = list(data.keys())
8080

8181
context = {}
82-
82+
8383
groupCount = len(
8484
MembershipV2.objects.filter(user=request.user.user, status="Approved")
8585
)

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ selenium==4.6.0
9595
pyotp==2.7.0
9696
attrs==21.3.0
9797
pytest==7.2.0
98-
pytest-django==4.5.2
98+
pytest-bdd==6.1.1
9999
pytest-cov==4.0.0
100+
pytest-django==4.5.2
100101
pytest-mock==3.10.0
101102
pylama==8.4.1
102103
semgrep==1.2.1

0 commit comments

Comments
 (0)