Skip to content
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

Feat: Admin and Mods #149

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Feat: Admin and Mods #149

wants to merge 11 commits into from

Conversation

TalentedB
Copy link
Contributor

@TalentedB TalentedB commented Aug 8, 2023

Features

Adds /set-user-roles endpoint taking in

    "user_id": "user_id",
    "roles": ["role1", "role2"],
    "action": "set"

user_id being the user's id being set
roles being the roles wanting to use
action either being set, add, or remove

Also does some organization of admin router,
Adds Mods related endpoints,
Adds Strict or Relaxed roles setting for middleware (either all the roles need to match or one)
Adds Role Assignment Logs table to Postgres
Adds Uni Specific Endpoints
Adds Uni Specific Mod Ranks

Notes

Closes #147

@gitguardian
Copy link

gitguardian bot commented Aug 8, 2023

⚠️ GitGuardian has uncovered 15 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id Secret Commit Filename
7593849 Bearer Token b3d471d features/admin/requests.http View secret
7604142 Bearer Token 90cd8ca features/admin/requests.http View secret
7604142 Bearer Token 90cd8ca features/admin/requests.http View secret
7605208 Bearer Token 157ee03 features/admin/requests.http View secret
7605209 Bearer Token 157ee03 features/admin/requests.http View secret
7619465 Bearer Token 7c1a908 features/admin/requests.http View secret
7619466 Bearer Token 7c1a908 features/admin/requests.http View secret
7619465 Bearer Token 7c1a908 features/admin/requests.http View secret
7619467 Bearer Token 7c1a908 features/admin/requests.http View secret
7658849 Bearer Token db72772 features/admin/requests.http View secret
7658850 Bearer Token db72772 features/admin/requests.http View secret
7658851 Bearer Token db72772 features/admin/requests.http View secret
7658852 Bearer Token db72772 features/reports/requests.http View secret
7658852 Bearer Token db72772 features/posts/requests.http View secret
7658852 Bearer Token db72772 features/comments/requests.http View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Our GitHub checks need improvements? Share your feedbacks!

db/models.go Outdated Show resolved Hide resolved
Comment on lines 55 to 61
mux.GET("/report", h.handleGetReportById) // TODO: Reports do not have school_id
mux.GET("/reports", h.handleGetReports) // TODO: Reports do not have school_id
mux.GET("/comments-by-report", h.handleGetRankedCommentsByReport) // TODO: Reports do not have school_id
mux.GET("/posts-by-report", h.handleGetRankedPostsByReport) // TODO: Reports do not have school_id
mux.GET("/reports-for-comment", h.handleFetchReportForCommentById) // TODO: Reports do not have school_id
mux.GET("/reports-for-post", h.handleFetchReportForPostById) // TODO: Reports do not have school_id

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODOs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todoing

features/admin/set_user_role.go Outdated Show resolved Hide resolved
features/admin/set_user_role.go Outdated Show resolved Hide resolved
lib/validation/models.go Show resolved Hide resolved
middleware/firebase_auth.go Outdated Show resolved Hide resolved
@TalentedB TalentedB requested review from mattrltrent and removed request for mattrltrent November 5, 2023 23:27
@@ -347,6 +348,7 @@ type Report struct {
Post *Post `gorm:"foreignKey:PostID" json:"post,omitempty"` // Use "omitempty" here
CommentID *uint `db:"comment_id" gorm:"default:NULL" json:"-"`
Comment *Comment `gorm:"foreignKey:CommentID" json:"comment,omitempty"` // Use "omitempty" here
SchoolID uint `gorm:"column:school_id" json:"-"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice school id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Admins & mods
2 participants