/// <summary> /// Перевіряємо чи дія дозволена /// </summary> /// <param name="role">Дія.</param> /// <returns></returns> public bool OpperationAllowed(string ActionCode) { // Реализуем метод интерфейса. ContextManager manager = new ContextManager(); SecurityUsersLogic user = new SecurityUsersLogic(manager); //if (this._indentity.Name == "Kas13") return(true); //else // return user.CheckAction(this._indentity.ID, ActionCode); }
/// <summary> /// Проверяем, существует ли имя пользователя в базе данных — файле XML. /// </summary> /// <param name="name">Имя пользователя.</param> /// <returns>ID пользователя.</returns> private int AuthUser(string name, string Hash) { // Считываем и сравниваем имя пользователя. ContextManager manager = new ContextManager(); SecurityUsersLogic users = new SecurityUsersLogic(manager); int userId = users.Get(name, Hash); if (userId >= 0) { this._isAuth = true; } else { this._isAuth = false; } manager.CloseContext(); return(userId); // Если пользователь не найден, генерируем исключение. throw new System.Security.SecurityException(String.Format("Пользователь {0} не найден в базе данных.", name)); }