Dynamically setting user roles?


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
The application I am considering StrataFrame for is project based. I.e. the data is all related to a project and the users role is based on project. On one project a user might be the project manager, having more permissions and on another she might be a reader, only able to view data, no edit/add/delete it. Is this possible using StrataFrames security?



As I see it, the user would be authenticated, then I would need to see what project they are working on and then change their role. This is probably covered in the helf file, but I'm running out of time to evaluate StrataFrame :-/



Thanks for you help!
Replies
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
[quote]You can learn more about this under the web applications authentication. Defining Security within the Application -> Web Applications -> Authenticating Users[\quote]



My help file doesn't have this section or I couldn't find it (in either the framework help or the security help). I searched the security help file for 'web' and there were no results. You have a newer help file than I do perhaps?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I am not sure when you last downloaded...but if you get the latest version the helps docs are updated.  Just to save a little time I attached the CHM to this post.
Attachments
HelpDocs.zip (199 views, 15.00 MB)
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks for the quick replies.



I was hoping that was the case regarding the CreatedBy and CreatedAt fields. BigGrin



I have 1.5.0. I haven't d/l or installed the newest version (1.5.1). I will attempt to get that done ASAP. The new help file is good. I'm reading it now...
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There are a number of enhancements and updates to the framework in 1.5.1 so I recommend doing this when you get the chance.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Will do. The new help file really helped. You didn't directly answer this question, but I'm getting very close to understanding how to do this:



What I'm still really unclear about is what exactly happens in the ShowLoginAndInitMainForm sub in AppMain.vb. There is one line of code there that calls the logon form, authenticates the user, sets that user as the current user (unless they cancel, then it closes the app), then opens the main form. Seems like I will need to take control of this so I can insert the project related stuff. Will I need to user my own login form? I assume this work doesn't happen in a form, right?




So, I get how to manually do this. The steps would be something like:



1. Get user credentials (user name and password) (question below about this)

2. Authenticate user using AuthenticateUser()

3. Using the us_pk property of the returned SFSUserBO, I would lookup the users default project in my own table and get the pk for the role to use with this project (using BO for this table of course)

4. Using the SFSUserXRolesBO, I would update the existing role for the user

5. Make this user the current user by calling SetLoggedInUser()

6. Show the main form if they didn't cancel out



Did I miss anything?



Now, a question about using an SF Login Form. I'm assuming I wouldn't use this at all, because it is part of the Login class (or rather it appears to be used by this class) and as such, I wouldn't have the control I need, correct? Or another way to ask the question, would the SF Login form be of any use to me here?

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Did I miss anything?

I think you're good Smile

Or another way to ask the question, would the SF Login form be of any use to me here?

If you download the latest 1.5.1 build, there is a template to create a custom login form.  You will want to use this as it ties into session locking, etc.  When you create the template, you will see that all of the required code is already in the form.  You can place your code to do your "permission swapping" in the click of the OK button.  Basically you will manually call the AuthenticateUser() to make sure the entered text is valid...if so, place your code to swap your permissions.  Then after you have done that, call the Me.OnAttemptLogin so that all of the remaining logic will remain in place.

I know that you can make this work...and I am pretty confident the instructions I gave you will work...but if not, let me know and we will address the issues one at a time.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Greg McGuffey - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Greg McGuffey - 19 Years Ago
Trent L. Taylor - 19 Years Ago
                     Ah! I see the confusion. Not projects at all in terms of...
Greg McGuffey - 19 Years Ago
                         Yes...that makes much more sense...What I would do in this case is...
Trent L. Taylor - 19 Years Ago
                             Almost. :D

This seems to me that what you just suggested if...
Greg McGuffey - 19 Years Ago
                                 You will have to keep track of the roles assigned to each users on a...
StrataFrame Team - 19 Years Ago
                                     Yep, I was planning on tracking the user/role/project myself and on...
Greg McGuffey - 19 Years Ago
                                         OK, not so quick reply :ermm:

I've been trying to figure...
Greg McGuffey - 19 Years Ago
                                             [quote] OK, not so quick reply [/quote] I don't know what happened...
Trent L. Taylor - 19 Years Ago
                                                 [quote]I don't know what happened here because I remember Ben...
Greg McGuffey - 19 Years Ago
                                                     OK, first question about updating the SFSUserXRoles table. There is a...
Greg McGuffey - 19 Years Ago
                                                         [quote]ur_CreatedBy and ur_CreatedAt fields[/quote] Leave these...
Trent L. Taylor - 19 Years Ago
                                                 [quote]You can learn more about this under the web applications...
Greg McGuffey - 19 Years Ago
                                                     I am not sure when you last downloaded...but if you get the latest...
Trent L. Taylor - 19 Years Ago
                                                         Thanks for the quick replies.

I was hoping that was the...
Greg McGuffey - 19 Years Ago
                                                             There are a number of enhancements and updates to the framework in...
Trent L. Taylor - 19 Years Ago
                                                                 Will do. The new help file really helped. You didn't directly answer...
Greg McGuffey - 19 Years Ago
                                                                     [quote]Did I miss anything? [/quote] I think you're good :)...
Trent L. Taylor - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search