Skip to content
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

Addresses most of Brandon's concerns #14

Open
wants to merge 73 commits into
base: main
Choose a base branch
from

Conversation

JasonRobertFrancis
Copy link
Contributor

No description provided.

Copy link
Contributor

@bsedwards bsedwards left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start. In addition to the comments in the files, I would suggest looking through the Error List tab for the files you've added and make sure Warnings are fixed, and Messages that are not just "style" related are fixed (for example, the unused variable messages).

There are still some things missing, compared to the old directory: phone numbers, the email host, user address, and student affiliations. Maybe the title and department columns can be combined to display this data. Also the Alt Photo link should be shown for users with SVMSecure.CATS.ServiceDesk.

How do you want to handle the "All UCD" mode of the directory, where it searches the campus LDAP first, and then adds our info?

I appreciate the work you've done on this! Once we figure out the permission issues with the IDs I can approve this as a starting point.

{
//TODO: Create the Directory Delegate Users role and add anyone with access to delegate roles
[Area("Directory")]
[Authorize(Roles = "VMDO SVM-IT,RAPS Delegate Users", Policy = "2faAuthentication")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Permission(Allow = "SVMSecure")] is probably a sufficient permission check. As it is now, this restricts the page to a much smaller set of users.

[Authorize(Roles = "VMDO SVM-IT,RAPS Delegate Users", Policy = "2faAuthentication")]
public class DirectoryController : AreaController
{
private readonly Classes.SQLContext.RAPSContext _RAPSContext;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to remove copy/pasted variables that are not needed in this class

List<IndividualSearchResult> results = new();
individuals.ForEach(m =>
{
results.Add(new IndividualSearchResult()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need a permission check here for the IDs. Since this data is sent to the browser via AJAX, it's visible to the user, even if not included in the page. One way to handle this would be the IndividualSearchResult class only containing data visible to everyone, and then an IndividualSearchResultWithIds child class containing the restricted data.

no-results-label="No results found">
<template v-slot:body-cell-photo="props">
<q-td :props="props">
<q-img :props="props" :src="'https://viper.vetmed.ucdavis.edu/public/utilities/getbase64image.cfm?mothraID=' + props.row.mothraId + '&altphoto=1'" style="width:87px; height:111px" :id="'photo_' + props.row.mothraId"></q-img>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a static function GetOldViperRootURL() in HttpHelper that could be used to get the url for Viper on the current server, instead of hard coding viper.vetmed.

createVueApp({
data() {
return {
userSearch: getItemFromStorage("searchField") ?? "",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The key for the storage has to be unique across all of VIPER, so consider prefixing searchField with, e.g. directory or some other prefix.

methods: {
findUsers: async function () {
this.users.urlBase = "search/" + this.userSearch
if (this.userSearch.length >= 3) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know I used 3 as the min length for RAPS, but it's been suggested to me that 2 might be better.

{
var individuals = await _aaud.AaudUsers
.Where(u => (u.DisplayFirstName + " " + u.DisplayLastName).Contains(search)
|| (u.MailId != null && u.MailId.Contains(search))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider allowing additional ID searches - pidm, spriden id, mothra id, employee id, iam id

});
results.ForEach(r =>
{
LdapUser l = new LdapService().GetUser(r.LoginId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm glad you were able to use this class!

I'm sure there will be additional back-and-forth, but here's the next round of changes:

--- [Permission(Allow = "SVMSecure")] is probably a sufficient permission check. As it is now, this restricts the page to a much smaller set of users.
Done

--- Make sure to remove copy/pasted variables that are not needed in this class
Sorry about that; I had left in some of my early code (as I was trying to figure out how all this works!). I removed the variables, but I added back in what seemed necessary to do the permission check.

--- We might need a permission check here for the IDs. Since this data is sent to the browser via AJAX, it's visible to the user, even if not included in the page. One way to handle this would be the IndividualSearchResult class only containing data visible to everyone, and then an IndividualSearchResultWithIds child class containing the restricted data.

Maybe you can help me think about a better way of doing this. I couldn't quite figure out how to use a generic to be able to switch between the two possible resulting objects.

--- There's a static function GetOldViperRootURL() in HttpHelper that could be used to get the url for Viper on the current server, instead of hard coding viper.vetmed.

Good tip. Thanks! Its seems like vue isn't very happy with localhost, but maybe adding a local certificate will help with some of the problems I am now getting.

--- The key for the storage has to be unique across all of VIPER, so consider prefixing searchField with, e.g. directory or some other prefix.
Fixed. I am now using directory_search

--- I know I used 3 as the min length for RAPS, but it's been suggested to me that 2 might be better.
Good suggestion. Fixed.

--- Consider allowing additional ID searches - pidm, spriden id, mothra id, employee id, iam id
Done

--- I'm glad you were able to use this class!
I added phone number to the LDAP lookup. If that is getting too unwieldy, we could pull it out of RAPS and create a generic LDAPlookup class.
@JasonRobertFrancis JasonRobertFrancis changed the title Adds first-draft of directory Addresses most of Brandon's concerns Jan 31, 2024
@JasonRobertFrancis
Copy link
Contributor Author

This is a great start. In addition to the comments in the files, I would suggest looking through the Error List tab for the files you've added and make sure Warnings are fixed, and Messages that are not just "style" related are fixed (for example, the unused variable messages).

There are still some things missing, compared to the old directory: phone numbers, the email host, user address, and student affiliations. Maybe the title and department columns can be combined to display this data. Also the Alt Photo link should be shown for users with SVMSecure.CATS.ServiceDesk.

How do you want to handle the "All UCD" mode of the directory, where it searches the campus LDAP first, and then adds our info?

I appreciate the work you've done on this! Once we figure out the permission issues with the IDs I can approve this as a starting point.

Thanks! I will work on a few of the remaining items (email host, address, student affiliations, alt photo). I will also need to think about the All UCD mode. I wanted to at least start a conversation about a few of my changes, so I thought it would be helpful to show you where I am now.

JasonRobertFrancis and others added 4 commits February 7, 2024 09:21
This is all pretty messy, but I think I can unwrap the debugging stuff once we figure out the error. The current message at /directory/search/francis/ucd is "DirectoryServicesCOMException: An invalid dn syntax has been specified." I thought the invalid username message I was getting earlier was an indication that at least the username/password was correct, but I am getting the invalid dn error even with [username] and [password]. Every filter string I have tried has returned the same error.
Next step is exploring cards for display instead of the table. I will focus more on making sure all the relevant data is displayed with the next update.
web/Classes/Utilities/LdapService.cs Dismissed Show dismissed Hide dismissed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants