Bootcamp:Chapter 11
No edit summary
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This is '''Chapter 11'''. Are you looking for the beginning? [[The 1000 steps program to MDriven Chapter 1|Find it here: Chapter 1]], or [[The 1000 steps program to MDriven Chapter 10|link to Chapter 10 (the previous chapter)]]
<message>Write the content here to display this box</message>
This is '''Chapter 11'''. Are you looking for the beginning? [[Training:Bootcamp:Chapter 1|Find it here: Chapter 1]], or [[Training:Bootcamp:Chapter 10|link to Chapter 10 (the previous chapter)]]


=== '''Video 11: Authentication'''  ===
=== '''Video 11: Authentication'''  ===
Line 16: Line 17:
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="00" tabindex="0"> Introduction </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="00" tabindex="0"> Introduction </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="220" tabindex="0"> Singleton Pattern </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="220" tabindex="0"> Singleton Pattern </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="705" tabindex="0"> CIS Supercross </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="705" tabindex="0"> SysSuperClass </span>
    <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="912" tabindex="0"> CIS Superclose </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="1432" tabindex="0"> External Login </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="1432" tabindex="0"> External Login </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="1765" tabindex="0"> Access Groups </span>
     <span class="navigation-item" data-video="j7NfjVZgZ38" data-start="1765" tabindex="0"> Access Groups </span>
Line 26: Line 26:
</html>
</html>


== Chapter 11: User Login, Access Groups, Default Superclass, Singleton Pattern, and Merge Model ==
== Chapter 11: User Login, Access Groups, Default SuperClass, Singleton Pattern, and Merge Model ==
332. Go to the Wiki, click on [[Documentation:Model Examples|Model Examples]] in the top menu, and download the '''SysUserAuthentication''' model.  
332. Go to the Wiki, click on [[Documentation:Model Examples|Model Examples]] in the top menu, and download the '''SysUserAuthentication''' model.  


333. Open and Merge in the downloaded file.
333. Open and Merge in the downloaded file.


334. Verify that SysSingleton has the property ''IsSingleton'' set in the objects inspector.
334. Verify that '''SysSingleton''' has the property ''IsSingleton'' set in the objects inspector.


335. Make sure you understand the Singleton pattern.
335. Make sure you understand the Singleton pattern.


* Check the Wiki and also google the concept: https://en.wikipedia.org/wiki/Singleton_pattern
* Check the Wiki and also google the concept: [[wikipedia:Singleton_pattern|Singleton_pattern]]


336. Start the prototyper with XML persistence.
336. Start the prototyper with XML persistence.


337. Test the OCLSingleton operator in the prototype with this expression:<code>SysSingleton.oclSingleton</code> - ensure you get an object.
337. Test the '''OCLSingleton''' operator in the prototype with this expression:<code><span class="col-black">SysSingleton.oclSingleton</span></code> - ensure you get an object.


338. Select the ''SysSingleton'' ''CurrentUser'' association in the class diagram. Check that Persistent is set to ''false,'' and thus, the association is transient.
338. Select the ''SysSingleton'' ''CurrentUser'' association in the class diagram. Check that Persistent is set to '''false''''','' and thus, the association is transient.


339. Select the '''SysSuperClass''' in the diagram. Check [[Documentation:OCLOperators OnCreate|OnCreate]]  and [[Documentation:OCLOperators OnUpdate|OnUpdate]] on the Wiki.
339. Select the '''SysSuperClass''' in the diagram. Check [[Documentation:OCLOperators OnCreate|OnCreate]]  and [[Documentation:OCLOperators OnUpdate|OnUpdate]] on the Wiki.


340. Make sure you understand what OnCreate and OnUpdate do. Follow the video on how the debugger is used to verify the theory on how it works.
340. Make sure you understand what '''OnCreate''' and '''OnUpdate''' do. Follow the video on how the debugger is used to verify the theory on how it works.


341. Ensure that '''SysSuperClass''' is the default superclass for the AuthenticationPackage.
341. Ensure that '''SysSuperClass''' is the default superclass for the '''AuthenticationPackage'''.


342. Check the oclIsTypeOf, oclIsKindOf, and superTypes operators in the debugger.
342. Check the '''oclIsTypeOf''', '''oclIsKindOf''', and '''superTypes''' operators in the debugger.


1. Write <code>SysSingleton.oclSingleton.oclIsTypeOf(SysSuperClass)</code>
1. Write <code><span class="col-black">'''SysSingleton.oclSingleton.oclIsTypeOf(SysSuperClass)'''</span></code>


* Execute (F5).
* Execute (F5).
* Verify you get ✅, signifying it is true
* Verify you get ✅, signifying it is true
2. Write <code>SysSingleton.oclSingleton.oclIsKindOf(SysSuperClass)SysSingleton</code>
2. Write <code><span class="col-black">'''SysSingleton.oclSingleton.oclIsKindOf(SysSuperClass)SysSingleton'''</span></code>
* Execute (F5)
* Execute (F5)
* Verify you get ✅, showing it’s a subclass of SysSuperClass
* Verify you get ✅, showing it’s a subclass of SysSuperClass
3. Write <code>SysSingleton.superTypes</code>
3. Write <code><span class="col-black">'''SysSingleton.superTypes'''</span></code>
* Verify you get “SysSuperClass”
* Verify you get “SysSuperClass”


343. Set the Default superclass of Package1 to ''SysSuperClass''.
343. Set the Default superclass of Package1 to '''SysSuperClass'''.


344. Start the debugger or refresh the model. Make sure Person now has the ChangeTime attribute.  
344. Start the debugger or refresh the model. Make sure '''Person''' now has the '''ChangeTime''' attribute.  


345. In the debugger, set the empty Guid property to a new Guid for all persons.
345. In the debugger, set the empty Guid property to a new Guid for all persons.


* Click on "Action" to change <code>Person.allinstances</code> from an OCL to an Action expression
* Click on "Action" to change <code><span class="col-black">Person.allinstances</span></code> from an OCL to an Action expression
* Set this expression: <code>Person.allinstances->collect(p|p.Guid:=Guid.NewGuid)</code>
* Set this expression: <code><span class="col-black">'''Person.allinstances->collect(p|p.Guid:=Guid.NewGuid)'''</span></code>
* Execute(F5). You should see a new Guid assigned to the Guid.
* Execute(F5). You should see a new Guid assigned to the Guid.
* Save
* Save


346. When you save all persons, ensure the ChangeTime is updated.
346. When you save all persons, ensure the '''ChangeTime''' is updated.


347. Start the Local Turnkey Prototyper.
347. Start the Local Turnkey Prototyper.
Line 80: Line 80:
349. Register a new user with email and password.
349. Register a new user with email and password.


350. Go to the debugger and check that you have a new SysUser object.
350. Go to the debugger and check that you have a new '''SysUser''' object.


* Input <code>SysUser.allinstances</code> and verify that a new SysUser has been created.
* Input <code><span class="col-black">SysUser.allinstances</span></code> and verify that a new '''SysUser''' has been created.


351. Go to the ViewModel Editor, select the CarSeeker ViewModel and click on the box to set its AccessGroups to ''IsLoggedIn''. Save.
351. Go to the ViewModel Editor, select the '''CarSeeker''' ViewModel and click on the box to set its AccessGroups to ''IsLoggedIn''. Save.


352. Try accessing '''CarSeeker'''. Ensure you cannot see '''CarSeeker''' when you are not logged in.
352. Try accessing '''CarSeeker'''. Ensure you cannot see '''CarSeeker''' when you are not logged in.
Line 96: Line 96:
356. Add a new access group: '''<span class="col-blue-navy">IsAdministrator</span>'''
356. Add a new access group: '''<span class="col-blue-navy">IsAdministrator</span>'''


* Set both the Enable Expression and Viable Expression to: <code>SysSingleton.oclSingleton.CurrentUser.IsAdmin=true</code>
* Set both the Enable Expression and Viable Expression to: <code>'''<span class="col-black">SysSingleton.oclSingleton.CurrentUser.IsAdmin=true</span>'''</code>
* Save  
* Save  


357. Refresh the AutoForms. Make sure you get Autoforms for SysUser.
357. Refresh the AutoForms. Make sure you get Autoforms for '''SysUser'''.


358. Go to AutoformSysUser and set the access group to ''IsAdministrator''.
358. Go to AutoformSysUser and set the access group to ''IsAdministrator''.
Line 105: Line 105:
359. Check the result on your webapplication.
359. Check the result on your webapplication.


360. Ensure you don't get access and get an error message ("Access denied").
360. Ensure you don't get access and get an error message ("<u>Access denied</u>").


361. Create a new ViewModel name '''AccessDenied''' to explain that the user does not have access.  Double-click to add the row and input '''<span class="col-blue-dark">“</span>''' in the Expression box. Save.
361. Create a new ViewModel name '''AccessDenied''' to explain that the user does not have access.  Double-click to add the row and input '''<span class="col-blue-dark">“</span>''' in the Expression box. Save.
Line 112: Line 112:


* Go to the debugger and Re-Read the model.
* Go to the debugger and Re-Read the model.
* Write the expression: SysUser.allinstances. Save
* Write the expression: <code><span class="col-black">'''SysUser.allinstances'''</span></code>. Save
* Open the Seeker and tick the ''IsAdmin'' box. Save
* Open the Seeker and tick the ''IsAdmin'' box. Save


363. Ensure you can get into '''AutoFormSysUserSeeker''' since you are now an administrator.
363. Ensure you can get into '''AutoFormSysUserSeeker''' since you are now an administrator.


364. Create a new user <code>b@b.se</code> (or something else) and log in as that. Confirm that this user does not reach the '''AutoFormSysUserSeeker''' but, ends up at the ''AccessDenied'' view.
364. Create a new user <code><span class="col-black">'''b@b.se'''</span></code> (or something else) and log in as that. Confirm that this user does not reach the '''AutoFormSysUserSeeker''' but, ends up at the ''AccessDenied'' view.


'''Next Chapter:'''  
=== '''Next Chapter''' ===
 
[[Training:Bootcamp:Chapter 12|Bootcamp:Chapter 12]]
[[The 1000 steps program to MDriven Chapter 12|The_1000_steps_program_to_MDriven_Chapter_12]]
[[Category:Bootcamp]]
[[Category:1000 Steps Program]]

Latest revision as of 05:47, 16 September 2024

This is Chapter 11. Are you looking for the beginning? Find it here: Chapter 1, or link to Chapter 10 (the previous chapter)

Video 11: Authentication

To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.

Steps 332 - 364 Introduction Singleton Pattern SysSuperClass External Login Access Groups Access Group Editor

Chapter 11: User Login, Access Groups, Default SuperClass, Singleton Pattern, and Merge Model

332. Go to the Wiki, click on Model Examples in the top menu, and download the SysUserAuthentication model.

333. Open and Merge in the downloaded file.

334. Verify that SysSingleton has the property IsSingleton set in the objects inspector.

335. Make sure you understand the Singleton pattern.

336. Start the prototyper with XML persistence.

337. Test the OCLSingleton operator in the prototype with this expression:SysSingleton.oclSingleton - ensure you get an object.

338. Select the SysSingleton CurrentUser association in the class diagram. Check that Persistent is set to false, and thus, the association is transient.

339. Select the SysSuperClass in the diagram. Check OnCreate  and OnUpdate on the Wiki.

340. Make sure you understand what OnCreate and OnUpdate do. Follow the video on how the debugger is used to verify the theory on how it works.

341. Ensure that SysSuperClass is the default superclass for the AuthenticationPackage.

342. Check the oclIsTypeOf, oclIsKindOf, and superTypes operators in the debugger.

1. Write SysSingleton.oclSingleton.oclIsTypeOf(SysSuperClass)

  • Execute (F5).
  • Verify you get ✅, signifying it is true

2. Write SysSingleton.oclSingleton.oclIsKindOf(SysSuperClass)SysSingleton

  • Execute (F5)
  • Verify you get ✅, showing it’s a subclass of SysSuperClass

3. Write SysSingleton.superTypes

  • Verify you get “SysSuperClass”

343. Set the Default superclass of Package1 to SysSuperClass.

344. Start the debugger or refresh the model. Make sure Person now has the ChangeTime attribute.

345. In the debugger, set the empty Guid property to a new Guid for all persons.

  • Click on "Action" to change Person.allinstances from an OCL to an Action expression
  • Set this expression: Person.allinstances->collect(p|p.Guid:=Guid.NewGuid)
  • Execute(F5). You should see a new Guid assigned to the Guid.
  • Save

346. When you save all persons, ensure the ChangeTime is updated.

347. Start the Local Turnkey Prototyper.

348. Try to login with any user.

349. Register a new user with email and password.

350. Go to the debugger and check that you have a new SysUser object.

  • Input SysUser.allinstances and verify that a new SysUser has been created.

351. Go to the ViewModel Editor, select the CarSeeker ViewModel and click on the box to set its AccessGroups to IsLoggedIn. Save.

352. Try accessing CarSeeker. Ensure you cannot see CarSeeker when you are not logged in.

353. Ensure you can see CarSeeker only when you are logged in.

354. Go to the AccessGroup-tool button found at the top menu, next to the Actions Editor button.

355. Check the expressions that build up the IsLoggedIn access group and see that you understand them.

356. Add a new access group: IsAdministrator

  • Set both the Enable Expression and Viable Expression to: SysSingleton.oclSingleton.CurrentUser.IsAdmin=true
  • Save  

357. Refresh the AutoForms. Make sure you get Autoforms for SysUser.

358. Go to AutoformSysUser and set the access group to IsAdministrator.

359. Check the result on your webapplication.

360. Ensure you don't get access and get an error message ("Access denied").

361. Create a new ViewModel name AccessDenied to explain that the user does not have access.  Double-click to add the row and input in the Expression box. Save.

362. Set the access group for AutoFormSysUserSeeker to IsAdministrator.

  • Go to the debugger and Re-Read the model.
  • Write the expression: SysUser.allinstances. Save
  • Open the Seeker and tick the IsAdmin box. Save

363. Ensure you can get into AutoFormSysUserSeeker since you are now an administrator.

364. Create a new user b@b.se (or something else) and log in as that. Confirm that this user does not reach the AutoFormSysUserSeeker but, ends up at the AccessDenied view.

Next Chapter

Bootcamp:Chapter 12

This page was edited 3 days ago on 09/16/2024. What links here