@@ -13,8 +13,7 @@ const documentTypes = [
1313
1414export async function findAll ( req , res ) {
1515 const executingUser = req . kauth . grant . access_token . content . sub
16- const year = req . query . year || ( await settingModel . findByPk ( 'currentYear' ) ) . value
17- const isLT = req . kauth . grant . access_token . content . groups ?. includes ( year + '_LT' )
16+ const isLT = req . kauth . grant . access_token . content . groups ?. includes ( 'Leitungsteam' )
1817 const allowed = isLT || ( await userPermissionModel . findOne ( { where : { uuid : executingUser , permission : 'userDocument' } } ) ) . allowed
1918 if ( ! allowed ) {
2019 res . status ( 403 ) . send ( )
@@ -35,8 +34,7 @@ export async function findOne(req, res) {
3534 }
3635 const executingUser = req . kauth . grant . access_token . content . sub
3736 const isSelf = executingUser === req . params . uuid
38- const year = ( await settingModel . findByPk ( 'currentYear' ) ) . value
39- const isLT = req . kauth . grant . access_token . content . groups ?. includes ( year + '_LT' )
37+ const isLT = req . kauth . grant . access_token . content . groups ?. includes ( 'Leitungsteam' )
4038 const allowed = isLT || isSelf || ( await userPermissionModel . findOne ( { where : { uuid : executingUser , permission : 'userDocument' } } ) ) . allowed
4139 if ( ! allowed ) {
4240 res . status ( 403 ) . send ( )
@@ -52,8 +50,7 @@ export async function findOne(req, res) {
5250
5351export async function createOrUpdate ( req , res ) {
5452 const executingUser = req . kauth . grant . access_token . content . sub
55- const year = ( await settingModel . findByPk ( 'currentYear' ) ) . value
56- const isLT = req . kauth . grant . access_token . content . groups ?. includes ( year + '_LT' )
53+ const isLT = req . kauth . grant . access_token . content . groups ?. includes ( 'Leitungsteam' )
5754 const allowed = isLT || ( await userPermissionModel . findOne ( { where : { uuid : executingUser , permission : 'userDocument' } } ) ) . allowed
5855 if ( ! allowed ) {
5956 res . status ( 403 ) . send ( )
0 commit comments