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
LdapExplorer front end #7683
LdapExplorer front end #7683
Conversation
8cd05ee
to
603ce03
Compare
97a68a1
to
0eccb89
Compare
@@ -80,6 +81,7 @@ const props = { | |||
} | |||
|
|||
const setup = (props, context) => { | |||
const conditionsComponent = inject(ProvidedKeys.conditionsComponent, components.FormGroupConditions) |
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.
Is there a better way to pass the different conditions component?
const item = await Promise.resolve(state.cache[id]).then(cache => _.cloneDeep(cache)) | ||
return filterOutLdapOptions(response, item.type) | ||
} else { | ||
const item = await api.item(id).then(item => { | ||
commit('ITEM_REPLACED', item) | ||
return _.cloneDeep(item) | ||
}).catch((err) => { | ||
commit('ITEM_ERROR', err.response) | ||
throw err | ||
}) |
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.
This is basically getAuthenticationSource
, but I couldn't find a way to reuse it. We should be able to just do this.getAuthenticationSource
if we use defineStore
from pinia
f2ecbfe
to
1f3dd90
Compare
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.
I think we should disable the "Add LDAP Condition" button if any of host
, port
, bind dn
or password
is empty.
We should also add :text
to all the above inputs to indicate something like "This field is required for LDAP conditions".
BaseInput, | ||
BaseInputChosenMultiple, | ||
BaseInputChosenOne, | ||
BaseInputGroupMultiplier, | ||
BaseInputNumber, | ||
BaseInputPassword, | ||
BaseInputRange |
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.
None of these except BaseInputChosenOne are returned in valueComponent, so the imports are not needed
pfComponentType() { | ||
return pfComponentType | ||
}, | ||
}, |
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.
computed declaration is using Vue2 pattern, can pfComponentType() be moved to setup?
default: () => { | ||
}, |
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.
Remove the \n in the middle of {}
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.
More cases below. Please change all instances.
let parsedEntries = new Set() | ||
for (let i = 0; i < ldapEntries.length; i++) { | ||
let value = ldapEntries[i][ldapAttribute] | ||
if (_.isArray(value)){ |
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.
Array.isArray() is good enough here, no need to create deps on lodash where they're not needed
const searchInput = ref("") | ||
const localValidator = inject('schema') |
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.
Use single quotes
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.
More cases below. Instead of cluttering the review, update all JS files to single quotes where possible.
The |
We need some kind of indicator on each row to quickly distinguish between IMO a |
I don't see what we gain by disabling the button. If we want a form where the workflow is 1. configure ldap connection 2. check connection 3. if connected proceed, we should make this a multipart form (gray out whole rules section or hide it). If we gray out a button we have to explain why it's grayed out. The dropdown select already has a good place to do it.
The fields are required anyways. The users should go down filling out the required fields. Ideally, the bind dn and password should be up the list, right after the required values. |
I didn't realize these could be empty. Disregard my comments for the required fields. |
By default the values are ints, but they get converted to string upon save/modification. This creates inconsistency to what the back end receives
811931d
to
0087957
Compare
I was able to rebase w/ devel (inc ldapexplorer_back_end) to get the backend service running, but the httpd.admin_dispatcher is not proxying /api/v1/ldap/search and instead returns a 404 Unless I'm mistaken, there appears to be a missing directive in conf/caddy-services/api.conf, this was likely missed in the backend PR, and it needs to copied to conf/caddy-services/api.conf.example (.example are renamed w/ fresh install) I tried the following, but wasn't able to verify that it works
Please adjust devel so the endpoint works and rebase this PR. I'll try this PR again after it's updated. |
* Core changes to implement LdapExplorer UI input * fix validation * Fix validation of search input * Fix ldap search input states * Extract multiselect style to a separate file * Move and cleanup ldap search UI files * Fix linting errors * Remove trailing ; in LdapSearchInput.vue * Add npm requirements for latest node and webpack-dev-server * Core changes to fetch attributes from an ldap server * Add lodash javascript package for convenience functions it offers * Extract value to select value conversion function * Add a draggable component that has static buttons * Differentiate ldap attribute fetching based on server type * Revert changes to BaseRuleCondition.vue related to ldap * Implement the core UI for ldap conditions * Add UI for ldap attribute selector * Debounce ldap search input * Add loading prop to multiselectFacade.vue * Fix minor issues with ldap condition UI * Add error feature to ldap attribute selector UI * Make LDAP attribute selector check connection based on form * Use quiet requests in background ldap searches * Add infrastructure to test the OpenLdap * Add openLdap server attribute extraction logic * Fix server parameter in LdapSearchInput.vue * Fix initial value bug in the LdapSearchInput.vue * Add not connected error to ldap value search * Improve ldapMultiselectFacade to ignore options when no connection * Adjust ldap search to parse array values * Extract common ldap request function between ldap server clients * Rename some ldap UI files and variables * Fix eslint errors in ldap code * Extract useLdapAttributes into composable * Inject ldap condition only in ldap authentication sources * Remove ldap condition from GoogleWorkspaceLDAP * Add ldap selector to Edir conditions * Fix a bug that sends form with int values if they are unmodified By default the values are ints, but they get converted to string upon save/modification. This creates inconsistency to what the back end receives * Add a common array for supported form types by ldap explorer * Fix a bug where unsupported forms were trying to use ldap explorer * Add a key for provided conditions component * Filter out ldap options in packetfence conditions * Add missing translations related to ldap explorer * Add clone condition button in ldap conditions * Change the ldap condition to be able to clone and append conditions * Add badges to differentiate conditions by type * Reformat and improve style of ldap explorer UI * Extract ldap error to a separate component * Show ldap error in all cases when connection fails * force update semver to address syyk vulnerability --------- Co-authored-by: Darren Satkunas <dsatkuna@akamai.com>
Description
Impacts
Look at "Authentication rule" "Conditions".
Code / PR Dependencies
Depends on #7634
NEW Package(s) required
Added packages related to the new webpack version not supporting polyfill
Issue
? internal ?
Delete branch after merge
YES
Checklist
(REQUIRED) - [yes, no or n/a]
After merge
Create an issue for replacing these UI inputs with ldap attribute selector:
Also, point out that we need to remove