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 {
118
118
if ( userId instanceof ParseUser ) {
119
119
userId = userId . id ;
120
120
} 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 ;
122
126
}
123
127
if ( typeof userId !== 'string' ) {
124
128
throw new TypeError ( 'userId must be a string.' ) ;
@@ -157,7 +161,11 @@ export default class ParseACL {
157
161
throw new Error ( 'Cannot get access for a ParseUser without an ID' ) ;
158
162
}
159
163
} 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 ;
161
169
}
162
170
var permissions = this . permissionsById [ userId ] ;
163
171
if ( ! permissions ) {
You can’t perform that action at this time.
0 commit comments