Migrating User Logins (SOS!)


Author
Message
Kotowari Lim
Kotowari Lim
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 3, Visits: 21
Dear experts,



I'm a newbie on Strataframe and has been delegated to do a project, as per subject mentioned. Well, I understand that this might not be a proper way of learning, but I'm really facing both difficulty during creating, as well as very limited and tight time frame provided (only left 3 days given). Following are the situations and task to do:



Requirements

1) A windows-based application to to migrate/import a list of user logins into strataframe (table: Users, UsersXRoles and etc.)

2) User Role inserted during migration (Role will be pre-defined before the process)

3) Password based on specific fields (eg. Password, Identification No., Passport No. etc.)

4) Source file from other database and table (eg. MSSQL: myDatabase, myTempLoginTable). This temporary table shall consists of full information required during the migration (eg. User login, First Name, Last Name, Password, Role and any others if necessary).



Please kindly enlight and assist me upon the matters (eg. what are the additional information needed, what are the references needed, how to defined Keys, how to encrypt relevant data and etc.). A full sample and/or source are very very very appreciated. Thanks in advance and really hope to hear from you guyz soon.





Thanks and regards



kotowari
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi kotowari,



Well that is not an easy task for a SF beginner BigGrin.



I assume that you have another system with Users and Security information and that you want to import those into SF Role-Base Security (RBS) tables. If that is the case I don't think is completely doable unless your previous systems uses the same logic as RBS, I would think that you may import users information, but I think it would be easier to simply define all the RBS Permissions and Roles and then assign each user the corresponding Role.



Start by reading about the RBS in the help file and then add the RBS to your application, once you know how it works, then you can decide if it would be a viable way to import your previous system data, in my opinion, unless you have hundreds of user with complicated security, it would be easier to just manually enter all the data in RBS.

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Edhy is right, this won't be simple. It's very doable, but not a simple drag and drop sorta thing.



Some tips to save you some time (these are a bit brief, as I'm currently under the weather):



- First and formost, I totally agree with Edhy, unless you have 100s of users, just doing this manually will be a lot easier and quicker.



If you do have hundreds of users.



- You'll need to do the import via code. SF stores much of the data about users in a binary field, which is accessable only via the SFS BOs (security BOs). The BO will handle encryption.

- You'll need to understand about the key used to encrypt this data. You set it via a the SF options in VS.

- You'll need to understand what data SF stores related to users. If you need other data stored, you'll need to create another table and create another BO (or maybe subclass the SFSUsersBO...depends on how much data differs).

- To do the import, you'll likely have a specific Import project in VS. You'll then create BOs to access the source tables. The logic to move the data would be pretty easy after that. Read about GetEnumerable() method of BOs (BusinessObjects).

- You need to understand the difference between roles and permissions in SF. Permissions are what control security in SF. Roles are management tools to help assign sets of permissions to users. Roles are thus less complicated to create (as they never actually have anything to do with application security). When migrating from one system to another, lots of times is very easy to migrate the roles. When I migrated my main app to SF, I had like 4 roles. I kept those 4 roles, but underneath those roles, there is now a fine grained permission system that allows for tons of options. I have something like a 100 permissions. As I developed the app, I'd just add the appropriate permissions to the migrated roles. Your situation might be different, but understanding this difference will be critical to getting it done correctly.



As far as specific examples/code samples, those are much easier to provide related to very specific questions.
Kotowari Lim
Kotowari Lim
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 3, Visits: 21
Thanks for your replies ...



Hell yeah, you are right. I have hundreds to thousands of users required to migrate, and I don't think the user wanna do such tedious work manually (including me). Actually, most of logins will have the same Role, as it is a Kiosk/Terminal system open up for all employees. Despite some of admins and/or higher permitted users, it is fine that we/customer will handle it manually. So probably we may just assume there are only 2 Roles, Admin Role (Full permission) and User Role (viewable on certain data screens only), with permissions defined respectively.



I think the UsersBO has been created earlier, but yet i'm facing tough issues while adding/inserting user record. I've successfully retrieve users data (means connection shouldn't be any problem, I assume), but it prompts me something during declaring a default value on a field:

Specified key is not a valid size for this algorithm.



I guess it is Key issue, which caused above message. At meantime, I would like to inquiry on how to generate the binary data manually or through SF? What are the information required and perhaps the steps to generate it ...



Again, Edhy and Greg, thanks for you replies ... and looking forward a bright light in-front.

Any sample coding/sources, please feel free to email to me at yllim@visualsolutions.com.my





Thanks and regards



kotowari
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Ok, here is a quick and dirty way to create users of course you need to add your validation and error trapping code, in my sample I only test for one broken rule, but there could be many.





'-- Create a new Security User Business Object.

Using userBO As New SFSUsersBO()

With userBO

'-- Add a new record and fill the required fields.

.NewRow()

.us_Username = "John"

.us_FirstName = "John"

.us_LastName = "Doe"

.us_DisplayName = String.Format("{0}, {1}", .us_FirstName, .us_LastName)

.us_PasswordPlainText = "password"

.us_ConfirmPassword = .us_PasswordPlainText



Dim saved As SaveUndoResult

saved = .Save()

If saved <> SaveUndoResult.Success Then

MessageBox.Show(.BrokenRules.ToArray(0).Description, "Error saving user", MessageBoxButtons.OK, MessageBoxIcon.Error)

End If

End With

End Using





I could not find specific details in SF help file to create Users, Permissions and Roles programatically, but with the above code you have a startup. I suggest you look at the MicroFour StrataFrame Security source code for samples on how to create permission and roles objects to be assigned to your users.



Like I said, this is not a straight forward task, it could take some time to complete, but with a bit of curiosity and help form SF team you can pull this off, not sure if it will be in your required time frame, but it is doable.

Edhy Rijo

Kotowari Lim
Kotowari Lim
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 3, Visits: 21
Hi Edhy,



Thanks for your reply and it does inspired ... After lots of failures and testings, found out that it requires to set security and vector key before the process. Well, following are the codings which successfully added a user:





SecurityManager.Instance.SetSecurityKeyAndVectorForUserAuthentication(SecurityCrypto.ReadKey);



this.myUsers.NewRow();

this.myUsers.us_Username = "John";

this.myUsers.us_FirstName = "John";

this.myUsers.us_LastName = "Doe";

this.myUsers.us_DisplayName = String.Format("{0}, {1}", this.myUsers.us_FirstName, this.myUsers.us_LastName);

this.myUsers.us_PasswordPlainText = "1qa!QA";

this.myUsers.us_ConfirmPassword = this.myUsers.us_PasswordPlainText;



SaveUndoResult result = this.myUsers.Save();



if (result != SaveUndoResult.Success)

{

MessageBox.Show(this.myUsers.BrokenRules.ToString(), "Error saving user", MessageBoxButtons.OK, MessageBoxIcon.Error);

}





After all, it seems this SecurityManager.Instance.SetSecurityKeyAndVectorForUserAuthentication(SecurityCrypto.ReadKey) (not sure what it really does; guess I need a proper and/or additional efforts to understand SF) is compulsory before inserting user records, meantime, it happens that password complexity has slightly consume some of my research time. Anyway, there are still few information (such as Role fields; UsersXRoles etc.) to be included before this project considered as running, and yea, I'll keep on testing and do it. Wish me luck.



Thanks again.



kotowari
Edhy Rijo
E
StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)StrataFrame VIP (3.7K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Kotowari Lim (01/26/2010)
After lots of failures and testings, found out that it requires to set security and vector key before the process. Well, following are the codings which successfully added a user:





Hi Kotowari,



That is the reason of my comment before:

Start by reading about the RBS in the help file and then add the RBS to your application...




In order for you to start adding users programatically you must have had setup the RBS in your application and you must have your Permissions and Roles setup, then you add your users and assign roles to them based on the information in your old system, but you MUST know how the RBS works and it MUST be working with your application prior to do anything else.



Now you are one step closer, so keep going and good luck!

Edhy Rijo

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (2.7K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Kotowari,



The key I was referring to is what you are handling with the SetSecurityKeyAndVectorForUserAuthentication method call. However, you should understand what this is doing as it affects how the user data is encrypted within the db table. Make sure you understand how this works.



Check out the Role Based Security section of the SF help file. Specificially the section on Defining Security within the Application. The first topic will give you an overview, Adding Security to an Application. Then use the links within that topic to understand the specifics as needed.



You can create roles and permissions via their respective SFS BO. In order to get this done, you likely will have to do a bit of digging to make sure that you are doing everything that needs to be done. As I suggested earlier, likely as part of the import process, you can create roles as needed and assign them to users, but permissions should likely be done during app development, as this is the connection point between RBS and the app. I.e. the security keys used on forms and data fields are the names of permissions. Roles are easy to manipulate, where as permissions require changes to the application.



As to your roles, you should likely understand how the built in Administrator role works. This is not set via a role or a permission, but is a property of a user (us_IsAdministrator). It allows access to everything.



As to your normal user role, I'd first suggest that you just create it manually. However, if based on how you are testing your import process, if you find yourself continually needing to recreate it, then I'd look into using the SFSRolesBO to create it. You'll need to access the role's PK when assigning users to that role though, no matter how you create it.



To assign the user to a role, use the SFSUsersXRolesBO. It's just a linking BO that links the PK of a user to the PK of a role.



Hope that helps!
Trent Taylor
Trent Taylor
StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)StrataFrame Developer (8.5K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Kotowari,



These guys have all given some great ideas. If you are still having troubles, please let me know. Thanks for your interest in StrataFrame and welcome to the forums.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search