Shawn O'Connor
going with the flow Posts:41
|
07-01-2008 12:38 PM |
|
Is it possible to setup a page redirect such that when a user's membership to a particular role expires that they are redirected to another page?
I tried setting up some rules so that if a user is a member of "Group A" they get directed to one page and if they are also a part of another group -- group B -- then they get directed to a different page. If the user is a member of Group A and Group B then I set a rule so that they get redirected to Group B's page. That works fine. However, if that person's membership to Group B expires then there is no difference. As the user is logically no longer part of Group B (the role is expired for that user), I would expect that the rule directing that user to the "Group A" page would take priority.
Is there another solution to this problem? --Thanks. |
|
|
|
|
Shawn O'Connor
going with the flow Posts:41
|
07-06-2008 08:27 AM |
|
Anybody? |
|
|
|
|
Chad Nash Posts:5260
|
07-10-2008 08:21 AM |
|
So when the users role expires... Is it still taking them to Group B? Where is it redirecting them to if its not Redirecting them to A or B? -Chad |
|
|
|
|
Shawn O'Connor
going with the flow Posts:41
|
07-10-2008 08:43 AM |
|
It's as though it doesn't "see" that the role has expired. It still takes them to Group B. Thanks for looking into this. |
|
|
|
|
Chad Nash Posts:5260
|
07-10-2008 10:13 AM |
|
Yep... We have discovered that this is a bug, its checking the UserRoles table and not the expiry date. We have updated the code but the module is currently undergoing some additional 'surgery' as we are adding the features to check for 'force password change' etc...
We should have a fix out within the next few weeks, sorry for the problem. In the mean time as a work around you could delete from the userroles table where the expiry date is less than the current date (such as an automated nightly SQL process or something?) just thinking of a work around for now...
-Chad |
|
|
|
|
Shawn O'Connor
going with the flow Posts:41
|
07-10-2008 10:49 AM |
|
I thought about that, but I don't want the person to be removed from the role. I want them to be a part of a role that gets renewed. So from a login redirect order of precedence the system should check to see if that person's role is active; if not, then redirect to the basic registered user's role (or some other) and invite them to renew their subscription. When they renew their subscription events should fire that extend their role membership from today's date + the length of their membership.
Actually, that does bring up a question -- I wonder if the event will fire? If I have an event that adds a user to a role for "X" amount of time upon the successful purchase of a subscription through Paypal -- if that person is already a member of said role will it extend the membership or just do nothing? And will it extend the role membership from the time it expired or from the time it was purchased?
Thanks. -- Shawn |
|
|
|
|
Shawn O'Connor
going with the flow Posts:41
|
12-14-2008 11:48 AM |
|
Any word on this? It's been more than a few weeks...Maybe it's already fixed and I just missed the memo about the patch? Please? |
|
|
|
|
Shawn O'Connor
going with the flow Posts:41
|
12-14-2008 11:52 AM |
|
As a suggestion for an enhancement -- it would be nice to set a status to redirect a given user to a specific page upon the status of the role they've been assigned. So if role status is current, then the default function of the module. If the role has expired, then something else -- redirect to a different page. |
|
|
|
|
Chad Nash Posts:5260
|
12-16-2008 11:56 AM |
|
Shawn,
Hi. Unfortunatly we do not have a fix out for this yet. We are somewhat under 'surgery' with Dynamic Login for it to also support the ability to redirect the user to Dynamic Registration for the ability to force password and profile changes etc... This has been fixed within the code for the next release but the only good work around for now would be to remove roles from users if they have already expired. We are shooting for a Feb 1st release of an updated version of Dynamic Login but I am not certain as we have several new enhancements coming.
The suggested work arounds for this would be:
1. Remove roles from users where the role date/time has expired
2. Modify the GetUserRole stored procedure within the DNN Core to only pull in the user role if the expire date is less then the current date.
Your suggestion would be a nice enhancement, we will review this after the next release. Again, this code has been changed to check the expire date, we just can't release it yet as there are other enhancements that are not yet done.
-Chad |
|
|
|
|
Chad Nash Posts:5260
|
12-18-2008 11:12 AM |
|
Shawn, Hi. I just wanted to follow up on this thread. We are actively working on the next build and it will add the enhancement you mentioned here as well (ability to setup different redirect events based on role status such as Active VS expired etc...) -Chad |
|
|
|
|
netspan
wading in the water Posts:21
|
02-24-2010 03:29 AM |
|
Posted By Chad Nash on 12/18/2008 1:12 PM
Shawn,
Hi. I just wanted to follow up on this thread. We are actively working on the next build and it will add the enhancement you mentioned here as well (ability to setup different redirect events based on role status such as Active VS expired etc...)
-Chad
The subject of this discussion seems to be exactly what I am trying to do. I have a number of roles in my site; I want to make one specific role have their passwords expire after 90 days, but all the other roles never expire. So I am looking for a means to redirect a user to a 'create new passwrd' page if they are in the specific role but their 90 days has expired. I am using version 3.10.20 of Dynamic Login, 4.0.30 Dynamic Registration (from the Module Definitions page). I cannot see anything in the Dynamic Login module management that lets me set conditional redirects as discussed in the thread above. |
|
|
|
|
netspan
wading in the water Posts:21
|
03-01-2010 04:23 AM |
|
OK I found the Renewal Reminder module. I can use this to create the reminder emails and I can use a bit of custom SQL in a scheduled job to set the 'force password renewal' flag when the role expires. So no problem... |
|
|
|
|
David To
river guide Posts:2719
|
03-01-2010 06:38 AM |
|
HI, sorry didn't respond sooner but yes, Renewal Reminder would be a perfect fit for your needs. -- David |
|
|
|
|
chupaul
going with the flow Posts:42
|
03-19-2010 10:18 AM |
|
Hi NetSpan,
I was wondering if you could share the custom Sql you're using to "force password renewal" when the role expires ?
Many Thanks, Paul
|
|
|
|
|
netspan
wading in the water Posts:21
|
03-23-2010 04:42 AM |
|
Paul
I haven't actually written the update yet! I did the research to locate the fields in the DNN tables that relate to the issue. There is a bit column UpdatePassword in the Users table, but the LastPasswordChangeDate is in the aspnet_Membership table which is indexed by the aspnet UserID which is different to the DNN UserID. The problem is to relate the whole lot. This is a query I developed to lookup the fields for users in a particular role:
declare
select
@AppId uniqueidentifier @AppID = ApplicationId from dbo.aspnet_Applications
where
LoweredApplicationName = 'dotnetnuke'
declare
set
U
@PortalID int @PortalID = 0SELECT .UserID, U.Username, U.UpdatePassword,
UP
UP
.PortalId, .IsDeleted,
AU
.UserId AS AspNet_UserId,
AM
.LastPasswordChangedDateFROM dbo.UserPortals AS UP RIGHT OUTER JOIN dbo.UserRoles UR INNER JOIN dbo.Roles R ON UR.RoleID = R.RoleID RIGHT OUTER JOIN dbo.Users AS U ON UR.UserID = U.UserID INNER JOIN dbo.aspnet_Users AU on U.Username = AU.UserName ON UP.UserId = U.UserID INNER JOIN dbo.aspnet_Membership AM on AU.UserId = AM.UserIdWHERE ( UP.PortalId = @PortalID OR @PortalID IS Null )
AND (UP.IsDeleted = 0 OR UP.IsDeleted Is NULL)
AND (R.RoleName = 'xyz')
AND (R.PortalId = @PortalID OR @PortalID IS Null )
Once you can identify the user in the aspnet tables then you have the means to update. Hope this helps.
AND AU.ApplicationId = @AppID |
|
|
|
|
netspan
wading in the water Posts:21
|
03-23-2010 04:52 AM |
|
the system simply discarded the code I tried to insert. Then it discarded a new message I sent. I am currently looking for a way to post code in this forum. |
|
|
|
|
netspan
wading in the water Posts:21
|
03-23-2010 05:44 AM |
|
OK, looks like there is some formatting issue if I cut-and-paste directly from SQL Server Management Studio. Instead I have removed all formatting by passing it through notepad. Hopefully this will enable iy to be read here...
declare @AppId uniqueidentifier
select @AppID = ApplicationId from dbo.aspnet_Applications
where LoweredApplicationName = 'dotnetnuke'
declare @PortalID int
set @PortalID = 0
SELECT
U.UserID, U.Username, U.UpdatePassword,
UP.PortalId,
UP.IsDeleted,
AU.UserId AS AspNet_UserId,
AM.LastPasswordChangedDate
FROM dbo.UserPortals AS UP
RIGHT OUTER JOIN dbo.UserRoles UR
INNER JOIN dbo.Roles R ON UR.RoleID = R.RoleID
RIGHT OUTER JOIN dbo.Users AS U ON UR.UserID = U.UserID
INNER JOIN dbo.aspnet_Users AU on U.Username = AU.UserName ON UP.UserId = U.UserID
INNER JOIN dbo.aspnet_Membership AM on AU.UserId = AM.UserId
WHERE ( UP.PortalId = @PortalID OR @PortalID IS Null )
AND (UP.IsDeleted = 0 OR UP.IsDeleted Is NULL)
AND (R.RoleName = 'xyz')
AND (R.PortalId = @PortalID OR @PortalID IS Null )
AND AU.ApplicationId = @AppID |
|
|
|
|
chupaul
going with the flow Posts:42
|
03-24-2010 06:39 PM |
|
Hi Netspan,
Ok, I will give it a try tomorrow.
Thanks for the sql !
Regards, Paul
|
|
|
|
|
netspan
wading in the water Posts:21
|
03-25-2010 01:01 AM |
|
Paul
Here is my finished stored procedure:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[ExpireUsersByRole]
@PortalID int,
@RoleName varchar(50),
@ExpireDays int
AS
declare @AppId uniqueidentifier
select @AppID = ApplicationId from dbo.aspnet_Applications
where LoweredApplicationName = 'dotnetnuke'
declare @CutOffDate datetime
select @CutOffDate = Dateadd(day,-@ExpireDays,Getdate())
declare @t table
(
UserName nvarchar(100)
update dbo.Users set UpdatePassword = 1
OUTPUT INSERTED.UserName INTO @t
FROM dbo.UserPortals AS UP
RIGHT OUTER JOIN dbo.UserRoles UR
INNER JOIN dbo.Roles R ON UR.RoleID = R.RoleID
RIGHT OUTER JOIN dbo.Users AS U ON UR.UserID = U.UserID
INNER JOIN dbo.aspnet_Users AU on U.Username = AU.UserName ON UP.UserId = U.UserID
INNER JOIN dbo.aspnet_Membership AM on AU.UserId = AM.UserId
WHERE ( UP.PortalId = @PortalID OR @PortalID IS Null )
AND U.UpdatePassword = 0
AND (UP.IsDeleted = 0 OR UP.IsDeleted Is NULL)
AND (R.RoleName = @RoleName)
AND (R.PortalId = @PortalID OR @PortalID IS Null )
AND AU.ApplicationId = @AppID
AND AM.LastPasswordChangedDate < @CutOffDate
-- pass back the users that have been expired
select * from @t
This does the update and returns a list of the users who were expired.
When your expired users try to log in, the Dynamic Login module will redirect them according to the module configuration as if the site admin had set the flag to force them to renew their passwords. So remember to configure that otherwise nothing useful will happen!
HTH |
|
|
|
|
netspan
wading in the water Posts:21
|
03-25-2010 01:04 AM |
|
That smiley should be a simple closing bracket to match the one at the start of the table definition. Forum software too clever for its own good!
|
|
|
|
|