管理员的Auth0角色

问题描述

我已经实现了在平台上使用的Auth0,并且正在创建“角色”以分配给特定用户。现在,我只想创建一个管理员”角色并将其分配给特定用户。目的是让我只希望这些特定的“管理员”能够查看或单击我们论坛页面上的“答案”按钮。

下面是论坛页面的一些代码

return (
      <div>
        {/* Table of questions - with option to answer
      using bootstrap 'Table' component */}
        <Table striped bordered hover variant='dark' responsive>
          <thead>
            <tr>
              <th>ID</th>
              <th>Question</th>
              <th>Asked by</th>
              <th>Labels/Tags</th>
              <th>Answer</th>
              <th>display Answers</th>
            </tr>
          </thead>
          <tbody>
            {/* within the table,take array  */}
            {this.state.questions.map((question) => {
              return (
                <tr key = {question._id}>
                  <td>{question._id}</td>
                  <td>{question.questionText}</td>
                  <td>{question.username}</td>
                  <td>{question.labels}</td>
                  <td><Button onClick={() => this.handleClickPostAnswer(question._id,question.questionText)}>Answer</Button></td>
                  <td><Button onClick={() => this.handleClickReadAnswers(question._id)}>display</Button></td>
                </tr>
              );
            })}
          </tbody>
          {/* renders AnswersModal if this.state.displayAnswers is true */}
          <AnswersModal show={this.state.displayAnswers}/>
        </Table>
      </div>
    );

下面是创建“答案”按钮的代码行。我只希望对此可见或能够被Auth0检测到的管理员单击。

<td><Button onClick={() => this.handleClickPostAnswer(question._id,question.questionText)}>Answer</Button></td>

有人能提出建议的最佳方法,还是将我指向可以帮助您解决问题的资源?我是否需要代替角色,而是在Auth0上创建规则?

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)