-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BLT Private Project #1737
Closed
Closed
BLT Private Project #1737
Changes from 50 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
64310e4
anonynomus user can't view private issue
HanilJain 2acf36a
Merge branch 'main' into issue-1685
HanilJain a44688d
anonymous user handling in API
HanilJain 7d21c90
Merge branch 'issue-1685' of https://github.com/HanilJain/BLT into is…
HanilJain 1ac233f
Merge branch 'OWASP:main' into issue-1685
HanilJain 499f91a
Merge branch 'main' into issue-1685
HanilJain eb800bf
request access
HanilJain 59ac12d
Merge branch 'OWASP:main' into issue-1090
HanilJain 27883ba
changes
HanilJain 0469a25
Merge branch 'main' into issue-1685
HanilJain 3e2ac4b
automated test added for relevant api
HanilJain 261c7a8
Merge branch 'OWASP:main' into issue-1090
HanilJain 5dbcf35
request access email
HanilJain 2d4b1c8
changes
HanilJain 14dc376
Merge branch 'issue-1685' into issue-1090
HanilJain a9eb1d1
Merge branch 'main' into issue-1090
HanilJain fb06ef0
priavte bug feature
HanilJain 758e2a8
Merge branch 'OWASP:main' into issue-1702
HanilJain 6fdf101
commit
HanilJain 980b359
Merge branch 'issue-1702' of https://github.com/HanilJain/BLT into is…
HanilJain 0832dfe
Merge branch 'main' into issue-1702
HanilJain 97e7c39
Merge branch 'main' into issue-1702
HanilJain 6d10870
Merge branch 'main' into issue-1702
HanilJain 24d0423
Merge branch 'main' into issue-1702
HanilJain 264e6fd
Merge branch 'main' into issue-1702
HanilJain aa5adbe
Merge branch 'main' into issue-1702
HanilJain 7823104
Merge branch 'main' into issue-1702
HanilJain 116dbe9
Merge branch 'main' into issue-1702
HanilJain c0515e7
Merge branch 'main' into issue-1702
HanilJain c0453c9
Merge branch 'main' into issue-1702
HanilJain 8aec6bd
changed urls
HanilJain e2db596
Merge branch 'issue-1702' of https://github.com/HanilJain/BLT into is…
HanilJain 8577c4f
Merge branch 'main' into issue-1702
HanilJain 08a92bc
Merge branch 'main' into issue-1702
HanilJain e0e395b
Merge branch 'main' into issue-1702
HanilJain e906e36
Merge branch 'main' into issue-1702
HanilJain 9c2e1c4
Merge branch 'main' into issue-1702
HanilJain 9c7a679
Merge branch 'OWASP:main' into issue-1702
HanilJain 59b8c58
commit
HanilJain 0046c96
Merge branch 'main' into issue-1702
HanilJain 64b6f8a
Merge branch 'main' into issue-1702
AtmegaBuzz 2d9b0ff
Merge branch 'main' into issue-1702
AtmegaBuzz 117cc70
Merge branch 'main' into issue-1702
AtmegaBuzz cfa9126
Merge branch 'main' into issue-1702
HanilJain 7758737
Merge branch 'main' into issue-1702
HanilJain 79c67d6
changes made
HanilJain 064db29
Merge branch 'issue-1702' of https://github.com/HanilJain/BLT into is…
HanilJain 5c04f51
Merge branch 'main' into issue-1702
HanilJain 0e6e712
Merge branch 'main' into issue-1702
HanilJain d8386c5
pre-commit
HanilJain 3147550
pre_commit
HanilJain 20789b4
run_test
HanilJain af32c56
suggested corrections
HanilJain 558c42a
Merge branch 'main' into issue-1702
DonnieBLT f7b2d77
Merge branch 'main' into issue-1702
HanilJain c9975e5
flatten the rename migrations
HanilJain aa6fb12
pre_commit issues
HanilJain 0594912
Merge branch 'main' into issue-1702
HanilJain cde7eda
Merge branch 'main' into issue-1702
HanilJain 89444c7
Merge branch 'main' into issue-1702
HanilJain efc7460
Merge branch 'main' into issue-1702
HanilJain c6f0d77
Merge branch 'main' into issue-1702
HanilJain 3e36387
Merge branch 'main' into issue-1702
HanilJain 84db212
Merge branch 'main' into issue-1702
HanilJain c941772
Merge branch 'main' into issue-1702
HanilJain 7e2081e
suggested changes
HanilJain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
from functools import wraps | ||
from django.contrib import messages | ||
from django.shortcuts import redirect | ||
from django.http import HttpResponse | ||
from website.models import Issue | ||
|
||
|
||
def private_test_function(user , user_pk , issue_pk): | ||
try : | ||
issue = Issue.objects.get(id= issue_pk) | ||
if user.pk == user_pk: | ||
if issue.user.pk == user.pk: | ||
return True | ||
return False | ||
|
||
except : | ||
if user.pk == user_pk: | ||
return True | ||
return False | ||
HanilJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
def private_access_check(message_to_deliver="Not allowed to \ | ||
access the Private page"): | ||
def decorator(view): | ||
@wraps(view) | ||
def _wrapped_view(request, *args, **kwargs): | ||
pk = kwargs.get('user_pk') | ||
issue_pk = kwargs.get('issue_pk') | ||
if not private_test_function(request.user , pk , issue_pk): | ||
messages.error(request, message_to_deliver) | ||
return redirect("/accounts/login") | ||
return view(request, *args, **kwargs) | ||
return _wrapped_view | ||
return decorator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Generated by Django 4.2.8 on 2024-02-01 11:57 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("website", "0081_userprofile_issue_downvoted"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="RequestAccess", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("message", models.CharField(blank=True, max_length=100, null=True)), | ||
( | ||
"issue", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="website.issue", | ||
), | ||
), | ||
( | ||
"user", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.8 on 2024-02-02 17:52 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("website", "0082_requestaccess"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="issue", | ||
name="viewer", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="viewer", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
28 changes: 28 additions & 0 deletions
28
website/migrations/0084_remove_issue_viewer_issue_viewer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.8 on 2024-02-02 21:48 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("website", "0083_issue_viewer"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
HanilJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
model_name="issue", | ||
name="viewer", | ||
), | ||
migrations.AddField( | ||
model_name="issue", | ||
name="viewer", | ||
field=models.ManyToManyField( | ||
blank=True, | ||
null=True, | ||
related_name="viewer", | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Generated by Django 5.0.2 on 2024-02-18 13:22 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("website", "0082_issue_reporter_ip_address"), | ||
("website", "0084_remove_issue_viewer_issue_viewer"), | ||
] | ||
|
||
operations = [] |
19 changes: 19 additions & 0 deletions
19
website/migrations/0086_rename_requestaccess_requestissueaccess.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.2 on 2024-02-24 00:14 | ||
|
||
from django.conf import settings | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("website", "0085_merge_20240218_1322"), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name="RequestAccess", | ||
new_name="RequestIssueAccess", | ||
HanilJain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HanilJain marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{% load custom_tags %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an HTML file, but labeled as.txt There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @DonnieBLT It mail content which will sent after an access is granted |
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
</head> | ||
<body style="margin: 0; padding: 0;"> | ||
<table style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr> | ||
<td> | ||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border: 1px solid #cccccc;"> | ||
<tr> | ||
<td align="center" style="padding: 40px 0 30px 0;"> | ||
<img src="https://{% env 'FQDN' %}/static/img/logo-large-transparent.png" alt="{% env 'PROJECT_NAME' %}" width="300" height="73" style="display: block;"/> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="left"> | ||
Hey, {{name}},<br> | ||
you have successfully granted viewership access of the following issue | ||
https://{% env 'FQDN' %}/issue2/{{ issue_pk }} | ||
|
||
Best,<br> | ||
<br> | ||
The {% env 'PROJECT_NAME' %} Team<br> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding: 30px 30px 30px 30px;"> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border: 1px solid #cccccc;"> | ||
<tr> | ||
<td align="center"> | ||
<table border="0" cellpadding="0" cellspacing="0"> | ||
<tr border="0" align="center"> | ||
<td> | ||
<a href="{% env 'TWITTER_URL' %}"> | ||
Twitter</a> | ||
</td> | ||
<td style="font-size: 0; line-height: 0;" width="20"> </td> | ||
<td> | ||
<a href="{% env 'FACEBOOK_URL' %}"> | ||
Facebook</a> | ||
</td> | ||
<td style="font-size: 0; line-height: 0;" width="20"> </td> | ||
<td> | ||
<a href="{% env 'GITHUB_URL' %}"> | ||
GitHub</a> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{% load custom_tags %} | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> | ||
</head> | ||
<body style="margin: 0; padding: 0;"> | ||
<table style="border: 1px solid #cccccc;" cellpadding="0" cellspacing="0" width="100%"> | ||
<tr> | ||
<td> | ||
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border: 1px solid #cccccc;"> | ||
<tr> | ||
<td align="center" style="padding: 40px 0 30px 0;"> | ||
<img src="https://{% env 'FQDN' %}/static/img/logo-large-transparent.png" alt="{% env 'PROJECT_NAME' %}" width="300" height="73" style="display: block;"/> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td align="left"> | ||
Hey, {{name}},<br> | ||
<a href="https://{% env 'FQDN' %}/profile/{{requester}}">{{ requester }}</a> has requested for the access of the following issue | ||
https://{% env 'FQDN' %}/issue2/{{ issue_pk }} | ||
|
||
Best,<br> | ||
<br> | ||
The {% env 'PROJECT_NAME' %} Team<br> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td style="padding: 30px 30px 30px 30px;"> | ||
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="border: 1px solid #cccccc;"> | ||
<tr> | ||
<td align="center"> | ||
<table border="0" cellpadding="0" cellspacing="0"> | ||
<tr border="0" align="center"> | ||
<td> | ||
<a href="{% env 'TWITTER_URL' %}"> | ||
Twitter</a> | ||
</td> | ||
<td style="font-size: 0; line-height: 0;" width="20"> </td> | ||
<td> | ||
<a href="{% env 'FACEBOOK_URL' %}"> | ||
Facebook</a> | ||
</td> | ||
<td style="font-size: 0; line-height: 0;" width="20"> </td> | ||
<td> | ||
<a href="{% env 'GITHUB_URL' %}"> | ||
GitHub</a> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DonnieBLT Made the changes !!
I think this was only required here ?
am I correct ?