Get roles of a user in certain portal dotnetnuke - dotnetnuke

i have a dotnetnuke with two portals that share users into 2 portals.
i want get roles of user A in portal 1 in a module in portal 2(in another portal)
how can i do that?

int portalId = 1;
UserInfo user = UserController.GetUserById(portalid, UserID);
You can get the list of roles for a user in a specific portal using array: user.Roles or you can check if the user is in a specific role using: user.IsInRole(roleName).

Related

Map groups to roles in Keycloak when using OIDC - Roles are not appending based on new Groups

I mapped AD groups to roles using Mappers. When I login with test user(with ADGroup1, ADGroup2),
In the Keycloak logged-in user's mapper roles (role1, role2) are assigned correctly.
When I remove a user from an AD group (-ADGroup2) in Azure. It was deleting role (-role2) in Keycloak after logging in again.
I tried to add the AD group (ADGroup2) back again. It was not an appending role again. Seeing only role1.
Mapper is configured as below:
ADGroup1 ==> test_client.role1
ADGroup2 ==> test_client.role2
If I delete both AD groups, user roles are also deleted in Keycloak. only appending is the problem.
thank you for posting your query. This seems like a user data sync delay. Could you please try to have "Sync Mode Override" to "force". This would update user data at each user login. Ref: https://github.com/keycloak/keycloak-documentation/blob/main/server_admin/topics/identity-broker/mappers.adoc
Thanks

KeyCloak LDAP Role mapper with AD groups

I have a KeyCloak LDAP federation question.
Using LDAP Federation I am trying to map specific AD groups to one specific KeyCloak role.
Example
Fido belongs to the AD Group "Dogs"
(LDAP:memberOf:cn=dogs,cn=users,dc=test,dc=com)
Fluffy belongs to the AD Group "Cats"
(LDAP:memberOf:cn=cats,cn=users,dc=test,dc=com)
I can get LDAP Federation to create the "cats" and "dogs" roles but what I really want to do in keycloak is have a role called "animals" that both fluffy and fido are assigned to.
Is this possible using the role-ldap-mapper?
Is there another way to do this?
Is this possible using the role-ldap-mapper? Is there another way to
do this?
First you need to map those groups "cats" and "dogs" from LDAP into roles in Keycloak, for that you can use the role-ldap-mapper Mapper. During the creation of those Mappers, after saving click on "Sync LDAP Roles to Keycloak".
After you have successfully import those roles into keycloak for each of the imported roles (i.e., cat and dog):
Go to Roles;
Click on the role in question;
Switch "Composite Roles" to ON
Select the role Animals (I am assuming that you have already created that role in Keycloak, otherwise do so);
Click on "Add selected"
Next time a user with the role Cats or Dogs from LDAP authenticates with Keycloak, the role Animals will show up in the token as well.

O365 - Unable to get Guest user email in SPPagecontextinfo

We have leveraged B2B to add 8 domains into one domain. Upon completion of adding other domain users as guest users, they are able to access the SharePoint site successfully. But the user logged in information like login name, Email address & user ID information is empty in SP page context info.
I have tried with a scenario like adding my organization account to the client tenant and verified. I'm able to get the context info about login name, email address & User ID.
Let me know if any one faced similar issue & any configurations to be made at source Azure AD/New Azure AD?

how to get all currenly logged-in user ids of anonymous user in drupal 7?

I have planed to create my own simple chat system. I am using wampserver on windowsxp. I need to get all currently logged-in user ids of anonymouse role in drupal 7. Having those ids we can get user names of all currently logged-in users from user table. so how do i get currently logged in user ids?
plase help me some to fix this problem.
"logged-in user ids of anonymous role" by default Drupal assigns 0 as uid for anonymous role.
If you want to display the users who is online currently, Drupal 7 comes with default block, "Who's online" block.
Goto Structure->Blocks and enable it to your preferred region.
and you can try Drupal chat module for chat feature.

DNN - Creating Admin users for Child Portals

I have a parent portal with a number of child portals contained within. My host user can access all of the portals, but when I create an admin user I cannot see the user (or it's new role) in the child portals. Is there a way to create an admin user that can update the contents of a module in all of the child portals (not the settings of the module)?
You will need to modify table "UserPortals", and add UserId for each portalid.
And also assign user with admin role on of each portal in table UserRoles, since each portal have different roleId for Administrators. (See table Roles)

Resources