Mono Class Library: System.Security.Principal.WindowsPrincipal Overview | Members

System.Security.Principal.WindowsPrincipal.IsInRole Method

Return the membership of the current principal in the specified role.

public virtual bool IsInRole (string role)

Parameters

role
The group name.

Returns

True if the current identity is a member of the specified role, false otherwise.

Remarks

On Unix systems, the role is mapped to Unix groups. For users to be considered to have a certain role, the role must be listed in the Unix groups (the /etc/group file) and it must contain a list of users that belong to that group.

For example, if you want to check that the user is in role "USAGNT\\UGR_RBP" the file /etc/group should contain a line like this:

/etc/group Example

USAGNT\UGR_RBP:x:300:miguel,don,jon,julia
  

In this particular example, the users miguel, don, jon and julia belong to the "USAGNT\UGR_RBP" role.

Requirements

Namespace: System.Security.Principal
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0