-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV-1 init Авторизации приложения в домен для доступа к информации о принтерах в веб-приложении #2
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f9d99d8
DEV-1 init Инициирование решения юнит тестирования
SinHole f1dec40
DEV-1 Init Создал сервис поиска принтеров
SinHole 233aea1
DEV-1 fix Исправил предупреждение совместимости OC
NotTastyCupcake 37eb8ad
DEV-1 Init Шаблон настроек
SinHole 2684ded
DEV-1 refactor Перенос сервиса поиска мониторов в Domain
NotTastyCupcake 9b49c56
DEV-1 feat Рефакторинг
SinHole 7ba8e36
DEV-1 fix Возвращаемый тип интерфейса поиска принтеров.
NotTastyCupcake e4f7cb3
DEV-1 fix/refactore Рефакторинг
NotTastyCupcake d8f2a84
DEV-1 test Интеграционный тест
NotTastyCupcake d93ad7f
DEV-1 test Получение списка принтеров
NotTastyCupcake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<RootNamespace>ProgGym.PrinterMonitor.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="System.DirectoryServices" Version="8.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Application\Application.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.DirectoryServices; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProgGym.PrinterMonitor.Domain_Win.Interfaces | ||
{ | ||
public interface IAuthDomain | ||
{ | ||
public DirectoryEntry Root { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.NetworkInformation; | ||
using System.Net.Sockets; | ||
using System.Net; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using ProgGym.PrinterMonitor.Application.Interfaces; | ||
using System.DirectoryServices; | ||
using ProgGym.PrinterMonitor.Application; | ||
using ProgGym.PrinterMonitor.Domain_Win.Interfaces; | ||
|
||
namespace ProgGym.PrinterMonitor.Domain_Win.Services | ||
{ | ||
public class SearchDeviceService : ISearchDeviceService | ||
{ | ||
private readonly IAuthDomain authDomain; | ||
private List<string?> printers = new List<string?>(); | ||
|
||
public SearchDeviceService(IAuthDomain authDomain) | ||
{ | ||
this.authDomain = authDomain; | ||
} | ||
|
||
//TODO: Создать модель-класс для получения нескольких данных о принтере | ||
public List<string?> GetPrinters() | ||
{ | ||
DirectorySearcher searcher = new DirectorySearcher(this.authDomain.Root); | ||
searcher.Filter = "(objectClass=printQueue)"; | ||
searcher.PropertiesToLoad.Add("cn"); | ||
foreach (SearchResult result in searcher.FindAll()) | ||
{ | ||
printers.Add(result.Properties["cn"][0].ToString()); | ||
} | ||
return printers; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using ProgGym.PrinterMonitor.Application; | ||
using ProgGym.PrinterMonitor.Domain_Win.Interfaces; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.DirectoryServices; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace ProgGym.PrinterMonitor.Domain_Win.Services | ||
{ | ||
public class AuthDevice: IAuthDomain | ||
{ | ||
private readonly MonitorSettings _monitorSettings; | ||
|
||
public DirectoryEntry Root { get; private set; } | ||
|
||
public AuthDevice(MonitorSettings monitorSettings) | ||
{ | ||
_monitorSettings = monitorSettings; | ||
|
||
Root = new DirectoryEntry(_monitorSettings.DomainPath, | ||
_monitorSettings.DomainUserName, | ||
_monitorSettings.DomainPassword); | ||
} | ||
|
||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using NUnit.Framework; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0-windows</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
<RootNamespace>ProgGym.PrinterMonitor.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" /> | ||
<PackageReference Include="Moq" Version="4.20.70" /> | ||
<PackageReference Include="NUnit" Version="3.13.3" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" /> | ||
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" /> | ||
<PackageReference Include="coverlet.collector" Version="3.2.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Domain-Win\Domain_Win.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
При получении коллекция должна быть не мутабельна, рекомендуется использовать readonly коллекциии