locked
Roles in lightswitch RRS feed

  • Question

  • this is the scenario:

    my domain: MyDomain.

    users: Oscar1, Oscar2, Oscar3.

    Database table: employees

    Table fields: name (readonly), activity.

    My Ls app is very simple, only a new data screen where users can add name and activities data.

    But i want that for exaple when Oscar1 was logged using windows creditials and tryed to add a new row he can only add activity and lightswitch automatic insert into name: oscar1.

    and where oscar3 logged using his own credentials and again add new data he can only add activity and the name automatic add oscar3

    thanks

    Thursday, February 28, 2013 6:22 PM

Answers

  • You can add code to the table's 'Employee_Created' event to pre-populate the 'Name' column automatically based on the authenticated user.

    You can add code to the data source's code for the 'Employee_Inserting' and 'Employee_Updating' events to ensure that 'Name' is as you wish it to be.

    There are other events to hook into and validation or filtering options just based on the authenticated user. Roles are not necessary in the scenario that you describe, though there may be other requirements that lend themselves to roles.


    Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.

    Thursday, February 28, 2013 6:58 PM