2017-10-05 22 views
0

我正在检查用户的任何角色是否是文档的允许角色的一部分。以下应匹配,因为用户是管理员+ 编辑,以及后允许由出版商+ 编辑阅读:正则表达式不匹配 - Firestore

service cloud.firestore { 
    match /databases/{database}/documents { 

    match /group/{groupId} { 
     match /posts/{postId} { 
     allow read: if 'admin,editor'.matches('((,|^)(publisher|editor)(,|$))'); 
     } 
    } 

    } 
} 

下面是一个正则表达式测试仪的工作吧:https://regex101.com/r/bDXMg3/2/

但这不匹配, 有任何想法吗?

回答

0

我们的文档可能会更清晰,但它看起来像整个字符串需要匹配。试试(.*,|^)(publisher|editor)(,.*|$)