How to create API accessible user account with Community
I am new to Khoros platform and want to crawl data from community. For that I did signup process with one lithium community and got my username and password. I am trying to authenticate myself with via retrieve-the-session-key but api response says curl --location --request \ POST 'https://community.alteryx.com/restapi/vc/authentication/sessions/login' \ --form 'user.login=dshrm' \ --form 'user.password=****' <response status="error"> <error code="302"> <message> User authentication failed. </message> </error> </response> I am trying to get user details via LiQl basic query `select * from users limit 1` What exactly process do I need to follow to authenticate myself ?1.7KViews
Sign in to react to this post11Comments
Default bio widget doen't work for plain Users and can't parse it from DB for plain Users
Hi folks. Need the help of the community brain. Found out that the default user bio widget, which parse User description from the settings doesn't work for plain Users except of Admins. So I decided to write my own component to parse that info from DB. Here is the code: <#include "theme-lib.common-variables.ftl" /> <#if user.registered > <#assign qry = "SELECT biography FROM users WHERE id = '${user.id}'"?url /> <#assign res = rest('2.0', '/search?q=${qry}') /> </#if> <@liaAddScript> ;(function() { const messageElement = document.querySelector('.lia-component-article'); if (!messageElement) return; <#if user.registered> <#if ( res.status?matches('success') && (res.data.size > 0) )> <#assign output = res.data.items[0].biography?esc /> const selectors = { main: '.lia-quilt-row-main', wrapper: '.lia-quilt-column-alley-single', ref: '#labelsForMessage', bio: 'custom-widget-user-bios' }; const parent = messageElement.querySelector(selectors.main + ' ' + selectors.wrapper); const refEl = messageElement.querySelector(selectors.ref); let p = document.createElement('p'); p.classList.add(selectors.bio); p.textContent = '${output}'; console.log(messageElement, refEl) parent.insertBefore(p, refEl); </#if> </#if> }()); </@liaAddScript> It Does work with Admins, but again, does not work with plain Users somewhy. It throw an exception in the console: <div style="font-style: italic; font-weight: lighter; color: darkGrey; background-color: Beige; padding: 10px;" class="lia-widget-not-found"> This widget could not be displayed. </div> Help me pls, what's going wrong with that user bio widget and Data i wanna parse it to the view by myself. Also I didn't find any flag in the admin that could representatively control that feature and enable/disable it.1KViews
Sign in to react to this post3Comments
Create custom endpoint to authenticate token/session key
In our community we aren't using the SSO approach, I'm trying to access community pages(Controlled by role permission) from one of our product websites and want some ideas to authenticate the call through a session key/token and create a auto login session with a common community user I created. I couldn't find much in Docs. Is there anyway I can achieve this? Any idea is much appreciated as we are working on a short deadline. Thanks in advance.900Views
Sign in to react to this post4Comments
Remove sensitive roles from inactive users
Saw this idea and couldn't remember if I shared this already. Basically an endpoint that gets called every day and Loops through a list of roles Finds users with those roles Checks that they're not special accounts, e.g. API user accounts Removes the sensitive roles Per affected user it lists the roles that were removed and the roles that remain Optionally sends a PM to the user to notify them Comments inline. I use Google Apps Script to schedule a daily run, but of course there are other options. Disclaimer: I'm not a trained programmer <#-- Automatically remove roles with permissions from users who haven't logged in for a while --> <#assign user_limit = http.request.parameters.name.get("user_limit", "100")?string /> <#-- How many days must the user have been inactive --> <#assign days_staff = http.request.parameters.name.get("", "50")?number /> <#assign days_mod = http.request.parameters.name.get("", "30")?number /> <#assign send_pm = http.request.parameters.name.get("pm", "false")?boolean /> <#-- Roles to remove from the users we find --> <#assign user_roles_remove = [ "Administrator", "LSI", "Level Two Moderator", "Lithium", "Moderator" ]/> <#-- Some users, like API accounts should be skipped, these are their IDs --> <#assign staff_exceptions = [ 123, 456, 789 ]/> </#if> <#assign users_pm_ids = []/> <#-- Spinning up a sequnce to store the IDs of users we may want to PM about their removed access --> <#assign today_long = .now?date?long/> <#assign prev_long_staff = today_long - days_staff * 1000 * 60 * 60 * 24/> <#assign prev_long_mod = today_long - days_mod * 1000 * 60 * 60 * 24/> <#-- convert the user's last visit date string to the long format for calculation --> <#function fnLVD(lvd)> <#assign lvd_show = lvd?datetime?string["yyyy-MM-dd"]/> <#assign lvd_long = lvd?datetime?long/> <#return lvd_long/> </#function> <xml> <users> <#-- Mods --> <#assign query_mod = restadmin("2.0","/search?q=" + "SELECT id,login,last_visit_time FROM users WHERE roles.name IN('Moderator','Level Two Moderator') LIMIT ${user_limit}"?url)/> <#list query_mod.data.items?sort_by("last_visit_time") as u> <#assign lvd_long = fnLVD(u.last_visit_time)/> <#if (lvd_long < prev_long_mod)> <#assign user_id = u.id/> <#assign user_login = u.login/> <#assign query_user_roles = restadmin("2.0","/search?q=" + "SELECT name FROM roles WHERE users.id = '${user_id}' LIMIT 500"?url)/> <#assign user_roles_before = []/> <#list query_user_roles.data.items as r> <#assign role_name = r.name/> <#assign user_roles_before = user_roles_before + [role_name]/> </#list> <#list user_roles_remove as r> <#if (user_roles_before?seq_index_of(r) …858Views
Sign in to react to this post0Comments
Create Custom Component Based On Roles
Hey Dev Discussion, right now in my community we're trying to leverage a component to show permissioned based boards depending on your role in the community. For example, we have 3 Roles: A, B, and C Role A has permission to the component and 2 links. Role B has permission to the component and 3 links are displayed but has Role A also. Role C has permission to the component and 4 links are displayed but have Role A and C. I believe I saw this code elsewhere and was trying to make edits to make this possible without creating separate components. When I did create separate components, for example, Role A could see their component. When signed into Role B could see Role A's links. And Role Bs could see their links in another component and Role A's component was still there. I hope this makes sense thus far! Haha! Here is the script I was going to leverage and attempt however, didn't seem to work when I tried to throw in <#elseifs>. <#attempt> <#assign user_has_role = false /> <#if user.registered > <#list restadmin("/users/id/${user.id?c}/roles").roles.role as role> <#if role.name?? && (role.name == "Employee" || role.name == "Administrator" || role.name == "Ambassador")> <#assign user_has_role = true /> </#if> </#list> </#if> <#if user_has_role > Role A <#elseif> Role B <#/elseif> <#elseif> Role C <#/elseif> <#/if> </#attempt> Open to other suggestions around this! Thank you!700Views
Sign in to react to this post1Comment
Migrating Posts & Users to SSO
We have a large group of external users who don't have SSO accounts set up yet (and we're a few months away). Can we allow 50-200 of them to register now (non-SSO) then later on, port their posts & badges to their SSO account?Solved547Views
Sign in to react to this post2Comments
Yes, you can setup non SSO accounts for them as of now. But after a couple of months, you will be on same stage where we are today.
I am working on a similar request below -
If there is a way to combine/convert users in Khoros?
Example: User1 was a member (registered through Khoros Native Reg), after a month, they become Customers.
Is there a way to covert their member account to a customer account? We use Customer Okta for authentication (OIDC)
Is there a way to combine/merge their member account to a customer account? In this scenario, they have two usernames User1 and User2
In our case, we generate SSO id on our product and then redirect them on the community where he need to fill the username for new SSO profile.
As per my understanding, activity migration(Posts, badges, kudos etc) from old non SSO user to new SSO user is not easy. We are planning to assign this new SSO id to those non SSO profiles so that users can retain their contribution activity logs in the profile.Sign in to react to this post
Group Role vs. Regular Roles
Hi, I'm trying to do something like this, but with group roles: <#assign is_gm = false /> <#list restadmin("/users/id/${user.id?c}/roles").roles.role as role> <#if role.name?? && (role.name == "GroupMember")> <#assign is_gm = true /> Then if it's true or false, I can make the page display accordingly. Apparently this doesn't work for Group Roles though, because it's doesn't recognize GroupMember as a role. So how do I modify it to check whether or not a person has a group role, as opposed to a regular role? Thanks546Views
Sign in to react to this post4Comments
configure the server with cache parameter
I would like to configure the server with cache parameter. Configure our server to return the Cache-Control HTTP response header: Cache-Control: max-age=31536000 Can someone assist me in doing this? Where should I update this detail?522Views
Sign in to react to this post3Comments
Select messages where user *doesn't have* FooBar role?
Objective: Create message list of messages posted by non-employees. SELECT yada, yoda FROM messages WHERE depth = 0 ** AND USER DOESN'T HAVE EMPLOYEE ROLE ** ORDER BY conversation.last_post_time LIMIT 100 From the LiQL reference, I don't see a constraint that will allow this. Is this possible?500Views
Sign in to react to this post2Comments
Can I assign signatures to everyone who doesn't have one?
I'd like to - by default - set users' signatures to their name (First Last) Our users' First & Last names are getting passed in by our IdP/SSO. I'm under the impression this can't be done automatically, BUT, is it possible to create a script to run periodically that'll do: for each user{ if (signature == ""){ signature = First Last } } If so that'd be sweet438Views
Sign in to react to this post1Comment