Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Temporary "New User" at login View modes: 
User avatar
Member
Member
kmiday-cuyahogalibrary - 4/1/2013 9:18:10 AM
   
Temporary "New User" at login
Hi Everyone,

What I want to do:

We're currently using mixed authentication with Active Directory. What I'd like to be able to do is assign a user role to users only the first time they log in, with that role set to expire in X number of days, or when they choose to no longer see new user alerts.

What I think I need to do:
I found this thread: http://devnet.kentico.com/Forums.aspx?forumid=13&threadid=1310 that talks about automatically assigning a role when someone registers, but how would this work since I'm using mixed authentication? My users will not be registering but will be using the standard login form with their AD login information. I don't want them assigned the role each time they login - only the first time they login.

I believe that the Membership API will come into play but I'm not sure how.

Thanks in advance.

User avatar
Member
Member
kentico_sandroj - 4/1/2013 1:02:24 PM
   
RE:Temporary "New User" at login
Hello,

One of the possible options is to add the code found here to the logon Web part, as well as a custom field in the CMS_User table that stores the expiration date. On logon you could set the expiration date to X days in the future. Once this is set up, you could create a scheduled task that regularly checks expiration dates. The recommended approach for dealing with users past expiration date is to disable them (Uncheck IsEnabled) or remove from the roles in the UI instead of the database; however, it is also possible to automate this task by Scheduling Custom Code.

Please let us know if this is an acceptable solution and if you need any further clarification.

Best Regards,
Sandro Jankovic

User avatar
Member
Member
kmiday-cuyahogalibrary - 4/10/2013 6:17:05 AM
   
RE:Temporary "New User" at login
Hi Sandro,

I was looking over the resources you suggested and I think that method would work. One issue I'm having is making sure it is only turned on when the user logs in for the first time, and not every time, since I'm using mixed authentication.

Thanks

User avatar
Kentico Consulting
Kentico Consulting
richards@kentico.com - 4/12/2013 1:32:55 AM
   
RE:Temporary "New User" at login
Hi,

I may have an Idea. How would it work if you would create a new column (field) in System table "User" such as "UserHasAlreadyLogged" which would be boolean and set to true or false. By default of course to false. Whenever a user logs you would check if this value is false, if it is do your job and if it isnt dont do anything.

Would that work?

Kind regards,
Richard Sustek