/// <summary>
 /// Gets a value indicating whether the specified user is in the specified role for the configured applicationName.
 /// </summary>
 /// <param name="user">The user to check for</param>
 /// <param name="roleName">The role to check for</param>
 /// <returns><b>true</b> if user is in role, <b>false</b> otherwise</returns>
 public bool IsUserInRole(User user, string roleName)
 {
     if (user == null)
     {
         return(false);
     }
     return(RoleDataSource.IsUserInRole(user.UserId, roleName));
 }
        /// <summary>
        /// Gets a value indicating whether the specified user is in the specified role for the configured applicationName.
        /// </summary>
        /// <param name="username">The name of the user to check for</param>
        /// <param name="roleName">The role to check for</param>
        /// <returns><b>true</b> if user is in role, <b>false</b> otherwise</returns>
        public override bool IsUserInRole(string username, string roleName)
        {
            User user = UserDataSource.LoadForUserName(username);

            if (user == null)
            {
                return(false);
            }
            return(RoleDataSource.IsUserInRole(user.UserId, roleName));
        }
Beispiel #3
0
 /// <summary>
 /// Determines whether a user is in the given role.
 /// </summary>
 /// <param name="roleId">The unique ID of the role to check.</param>
 /// <returns>True if the user is in the given role; false otherwise.</returns>
 public bool IsInRole(int roleId)
 {
     return(RoleDataSource.IsUserInRole(this.UserId, roleId));
 }
Beispiel #4
0
 /// <summary>
 /// Determines whether a user is in the given role.
 /// </summary>
 /// <param name="name">The name of the role to check.</param>
 /// <returns>True if the user is in the given role; false otherwise.</returns>
 public bool IsInRole(string name)
 {
     return(RoleDataSource.IsUserInRole(this.UserId, name));
 }