File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ module.exports = {
5454
5555 // Check session's read authority
5656 const user = await userService . findOne ( { serviceNumber : res . locals . serviceNumber } ) ;
57- if ( ! item . accessGroups . read . some ( i => i . equals ( user . group ) ) )
57+ if ( ! item . accessGroups . read . some ( i => i . equals ( user . group ) ) && item . owner . _id !== res . locals . _id )
5858 throw new ForbiddenError ( `Access denied: μ΄λ κΆνμ΄ μμ΅λλ€.` ) ;
5959
6060 res . status ( 200 ) . send ( item ) ;
@@ -109,7 +109,7 @@ module.exports = {
109109 if ( item === null ) throw new NotFoundError ( `Item not Found: μ‘΄μ¬νμ§ μλ νλͺ©μ
λλ€.` ) ;
110110
111111 // Check session's edit authority
112- if ( ! item . accessGroups . edit . some ( i => i . equals ( res . locals . group ) ) )
112+ if ( ! item . accessGroups . edit . some ( i => i . equals ( res . locals . group ) ) && item . owner . _id !== res . locals . _id )
113113 throw new ForbiddenError ( `Access denied: μμ κΆνμ΄ μμ΅λλ€.` ) ;
114114
115115 // Append Contributor
@@ -137,6 +137,10 @@ module.exports = {
137137
138138 if ( item === null )
139139 throw new NotFoundError ( `Item not Found: μ‘΄μ¬νμ§ μλ νλͺ©μ
λλ€.` ) ;
140+
141+ // Check session's delete authority
142+ if ( item . owner . _id !== res . locals . _id )
143+ throw new ForbiddenError ( `Access denied: μμ κΆνμ΄ μμ΅λλ€.` ) ;
140144
141145 // Algolia
142146 await algolia . deleteObject ( item_id ) ;
Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ module.exports = {
109109 group : loginUser . group ,
110110 status : loginUser . status ,
111111 } , JWT_SECRET_KEY , {
112- expiresIn : '1h ' ,
112+ expiresIn : '12h ' ,
113113 } ) ;
114114
115115 return user ;
You canβt perform that action at this time.
0 commit comments