> For the complete documentation index, see [llms.txt](https://o2oa.gitbook.io/course/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://o2oa.gitbook.io/course/ping-tai-shi-shi/zu-zhi-guan-li/untitled/jiao-se-xin-xi.md).

# 角色信息

### **1.  获取角色信息：getRole**

| **函数说明**                                                                                                          | var roleObj= this.org.getRole(name); |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| **参数说明**                                                                                                          | name : （string）必选，角色名                |
| **返回值**                                                                                                           | roleObj: 返回角色的对象数组。                  |
| **脚本示例**                                                                                                          |                                      |
| <p>var name = "Manager";</p><p>var roleObj = this.org.getRole (name);</p><p>return roleObj.distinguishedName;</p> |                                      |

### ２. 人员所有角色（嵌套）：listRoleWithPerson

| **函数说明**                                                   | var roleObj= this.org.listRoleWithPerson (name); |
| ---------------------------------------------------------- | ------------------------------------------------ |
| **参数说明**                                                   | name : （string）必选，个人                             |
| **返回值**                                                    | roleObj: 返回角色的对象数组。                              |
| **脚本示例**                                                   |                                                  |
| var roleObj = this.org.listRoleWithPerson (“李杰@lijie\@P”); |                                                  |

### **３. 人员是否拥有角色：personHasRole**

| **函数说明**                                                                                      | var roleObj= this.org.personHasRole(name,role) |    |        |                         |
| --------------------------------------------------------------------------------------------- | ---------------------------------------------- | -- | ------ | ----------------------- |
| **参数说明**                                                                                      | <p>name : （string）必选，人员的distinguishedName      | id | unique | name</p><p>Role：角色名</p> |
| **返回值**                                                                                       | true, false                                    |    |        |                         |
| **脚本示例**                                                                                      |                                                |    |        |                         |
| <p>var hasRole = this.org. personHasRole("林林@linlin\@P","Manager");</p><p>return hasRole;</p> |                                                |    |        |                         |
