File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,11 @@ export default class ParseACL {
118118 if ( userId instanceof ParseUser ) {
119119 userId = userId . id ;
120120 } else if ( userId instanceof ParseRole ) {
121- userId = 'role:' + userId . getName ( ) ;
121+ const name = userId . getName ( ) ;
122+ if ( ! name ) {
123+ throw new TypeError ( 'Role must have a name' ) ;
124+ }
125+ userId = 'role:' + name ;
122126 }
123127 if ( typeof userId !== 'string' ) {
124128 throw new TypeError ( 'userId must be a string.' ) ;
@@ -157,7 +161,11 @@ export default class ParseACL {
157161 throw new Error ( 'Cannot get access for a ParseUser without an ID' ) ;
158162 }
159163 } else if ( userId instanceof ParseRole ) {
160- userId = 'role:' + userId . getName ( ) ;
164+ const name = userId . getName ( ) ;
165+ if ( ! name ) {
166+ throw new TypeError ( 'Role must have a name' ) ;
167+ }
168+ userId = 'role:' + name ;
161169 }
162170 var permissions = this . permissionsById [ userId ] ;
163171 if ( ! permissions ) {
You can’t perform that action at this time.
0 commit comments