-
Notifications
You must be signed in to change notification settings - Fork 23
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
Task #215826 Task #215928 Addition of AclGuard permissions to the modules #938
Open
YoginiTayade
wants to merge
17
commits into
tekdi:feat-acl
Choose a base branch
from
YoginiTayade:kit-materials
base: feat-acl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
b58abd1
added permission and acl to kit-material
5e025f9
added aclguard and permissions to references controller
42e06df
added permission to pcrscore controller
4274726
completed session controller for aclguard
04d79c9
completed upload-file module
e23d5b3
completed edit-request module
0621d15
moved all of the pr into one
24d8f0a
trying as pr is not reflecting
36b9756
applied aclguard to user controller
771a618
refactored aclhelper
d738f6a
corrected the entities and permissions
324187b
list pis of beneficiaries completed
b7f64df
list apis for camps completed
b7da84b
refactored list functions for aclguard
0275caf
added the ownership function required entities
ebc3760
completed aclguard
c6187b9
resolved coflicts on the local branch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,26 +10,62 @@ import { | |
} from '@nestjs/common'; | ||
import { AuthGuard } from 'src/modules/auth/auth.guard'; | ||
import { KitMaterialsService } from './kit-materials.service'; | ||
import { AclGuard } from 'src/common/guards/acl.guard'; | ||
import { AclGuardData } from 'src/common/decorators/aclguarddata.decorator'; | ||
import { AclHelper } from 'src/common/helpers/acl.helper'; | ||
|
||
@Controller('kitmaterials') | ||
@UseGuards(AuthGuard) | ||
export class KitMaterialsController { | ||
constructor(private readonly kitMaterialsService: KitMaterialsService) {} | ||
constructor( | ||
private readonly kitMaterialsService: KitMaterialsService, | ||
private aclHelper: AclHelper, | ||
) {} | ||
|
||
@Post('/create') | ||
@UseGuards(AuthGuard) | ||
create(@Req() request: any, @Body() body: any, @Res() response: any) { | ||
@UseGuards(AclGuard) | ||
@AclGuardData('kit-material', ['create']) | ||
async create(@Req() request: any, @Body() body: any, @Res() response: any) { | ||
if ( | ||
!(await this.aclHelper.doIHaveAccess( | ||
request, | ||
'kit-material', | ||
body.camp_id, | ||
)) | ||
) { | ||
return response.status(403).json({ | ||
success: false, | ||
message: 'FORBIDDEN', | ||
data: {}, | ||
}); | ||
manojLondhe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
return this.kitMaterialsService.create(body, request, response); | ||
} | ||
|
||
@Get('/list/:camp_id') | ||
@UseGuards(AuthGuard) | ||
list( | ||
@UseGuards(AclGuard) | ||
@AclGuardData('kit-material', ['read.own']) | ||
async list( | ||
@Req() request: any, | ||
@Body() body: any, | ||
@Res() response: any, | ||
@Param('camp_id') camp_id: number, | ||
) { | ||
if ( | ||
!(await this.aclHelper.doIHaveAccess( | ||
request, | ||
'kit-material', | ||
camp_id, | ||
)) | ||
) { | ||
return response.status(403).json({ | ||
success: false, | ||
message: 'FORBIDDEN', | ||
data: {}, | ||
}); | ||
} | ||
Comment on lines
+48
to
+68
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. Similar to the |
||
return this.kitMaterialsService.List(body, request, response, camp_id); | ||
} | ||
} |
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
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.
Replace
console.log
with a more robust logging mechanism.Committable suggestion