File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed
Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -190,20 +190,20 @@ export const allowedAuthoritiesForInvitation = (user, selectedRoles) => {
190190 . filter ( auth => AUTHORITIES_HIERARCHY [ auth ] > AUTHORITIES_HIERARCHY [ allowedAuthority ] ) ;
191191 }
192192 }
193- const userRolesForSelectedRoles = selectedRoles
194- . map ( role => role . isUserRole ? role . role : role )
195- . filter ( role => ( ! isEmpty ( user . organizationGUID ) && user . organizationGUID === role . organizationGUID ) ||
196- user . userRoles . some ( userRole => userRole . role . id === role . id ) )
197- . filter ( userRole => ! isEmpty ( userRole ) ) ;
198-
199- if ( ! isUserAllowed ( AUTHORITIES . INVITER , user ) ) {
200- return [ ] ;
201- }
202193 if ( isEmpty ( selectedRoles ) ) {
203194 const authority = highestAuthority ( user ) ;
204195 return Object . keys ( AUTHORITIES )
205196 . filter ( auth => AUTHORITIES_HIERARCHY [ auth ] > AUTHORITIES_HIERARCHY [ authority ] ) ;
206197 }
198+ const userRolesForSelectedRoles = selectedRoles
199+ . filter ( role => {
200+ role = role . isUserRole ? role . role : role ;
201+ return ( ! isEmpty ( user . organizationGUID ) && user . organizationGUID === role . organizationGUID ) ||
202+ user . userRoles . some ( userRole => userRole . role . id === role . id )
203+ } ) ;
204+ if ( ! isUserAllowed ( AUTHORITIES . INVITER , user ) ) {
205+ return [ ] ;
206+ }
207207 const leastImportantAuthority = userRolesForSelectedRoles
208208 . reduce ( ( acc , userRole ) => {
209209 if ( acc === null || AUTHORITIES_HIERARCHY [ userRole . authority ] > AUTHORITIES_HIERARCHY [ acc ] ) {
You can’t perform that action at this time.
0 commit comments