aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web/ActiveDirectory
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2025-04-22 21:51:47 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2025-04-22 21:51:47 +0300
commitf33925e973cfaa9be4d46abd81f63afe787c6607 (patch)
tree8765cbd70e13bcf2386343f1d7475b3bbb306869 /Software/Visual_Studio/Tango.Web/ActiveDirectory
parentf0d2b8a0c3014aea6030c2ab0847755e5f67a6c0 (diff)
downloadTango-f33925e973cfaa9be4d46abd81f63afe787c6607.tar.gz
Tango-f33925e973cfaa9be4d46abd81f63afe787c6607.zip
Prevent AD group check using AD Graph API.
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/ActiveDirectory')
-rw-r--r--Software/Visual_Studio/Tango.Web/ActiveDirectory/ActiveDirectoryManager.cs64
1 files changed, 32 insertions, 32 deletions
diff --git a/Software/Visual_Studio/Tango.Web/ActiveDirectory/ActiveDirectoryManager.cs b/Software/Visual_Studio/Tango.Web/ActiveDirectory/ActiveDirectoryManager.cs
index 0a0a1d476..b96241612 100644
--- a/Software/Visual_Studio/Tango.Web/ActiveDirectory/ActiveDirectoryManager.cs
+++ b/Software/Visual_Studio/Tango.Web/ActiveDirectory/ActiveDirectoryManager.cs
@@ -30,43 +30,43 @@ namespace Tango.Web.ActiveDirectory
return authResult;
}
- public List<Group> GetUserGroups(String email)
- {
- var authResult = GetAppAuthenticationResult();
- ActiveDirectoryClient activeDirectoryClient = new ActiveDirectoryClient(new Uri($"https://graph.windows.net/{WebConfig.TENANT_ID}"), async () => await Task.FromResult(authResult.AccessToken));
- var user = activeDirectoryClient.Users.Where(x => x.UserPrincipalName == email).ExecuteSingleAsync().Result;
+ //public List<Group> GetUserGroups(String email)
+ //{
+ // var authResult = GetAppAuthenticationResult();
+ // ActiveDirectoryClient activeDirectoryClient = new ActiveDirectoryClient(new Uri($"https://graph.windows.net/{WebConfig.TENANT_ID}"), async () => await Task.FromResult(authResult.AccessToken));
+ // var user = activeDirectoryClient.Users.Where(x => x.UserPrincipalName == email).ExecuteSingleAsync().Result;
- var userFetcher = (IUserFetcher)user;
+ // var userFetcher = (IUserFetcher)user;
- List<Group> groups = new List<Group>();
+ // List<Group> groups = new List<Group>();
- IPagedCollection<IDirectoryObject> pagedCollection = userFetcher.MemberOf.ExecuteAsync().Result;
- do
- {
- List<IDirectoryObject> directoryObjects = pagedCollection.CurrentPage.ToList();
- foreach (IDirectoryObject directoryObject in directoryObjects)
- {
- if (directoryObject is Group)
- {
- var group = directoryObject as Group;
- groups.Add(group);
- }
- }
- pagedCollection = pagedCollection.GetNextPageAsync().Result;
- } while (pagedCollection != null);
+ // IPagedCollection<IDirectoryObject> pagedCollection = userFetcher.MemberOf.ExecuteAsync().Result;
+ // do
+ // {
+ // List<IDirectoryObject> directoryObjects = pagedCollection.CurrentPage.ToList();
+ // foreach (IDirectoryObject directoryObject in directoryObjects)
+ // {
+ // if (directoryObject is Group)
+ // {
+ // var group = directoryObject as Group;
+ // groups.Add(group);
+ // }
+ // }
+ // pagedCollection = pagedCollection.GetNextPageAsync().Result;
+ // } while (pagedCollection != null);
- return groups;
- }
+ // return groups;
+ //}
- public bool IsUserMemberOf(String group, String email)
- {
- return GetUserGroups(email).Exists(x => x.DisplayName == group);
- }
+ //public bool IsUserMemberOf(String group, String email)
+ //{
+ // return GetUserGroups(email).Exists(x => x.DisplayName == group);
+ //}
- public bool CanUserAccessCurrentEnvironment(String email)
- {
- var groups = GetUserGroups(email);
- return groups.Exists(x => x.DisplayName == WebConfig.ENVIRONMENT_GROUP);
- }
+ //public bool CanUserAccessCurrentEnvironment(String email)
+ //{
+ // var groups = GetUserGroups(email);
+ // return groups.Exists(x => x.DisplayName == WebConfig.ENVIRONMENT_GROUP);
+ //}
}
}