MVC planning poker – First vertical – security – part 3

Let’s read the Use Case 3, Boot from table:

Use Case 3: Moderator can boot from the table
Moderator can boot from the table( permanently of just for this session ) any participant.
If permanently, the participant with this name can not join anymore

 

The following code is written , for adding a participant to be booted from table

public void UseCase3RightPath()
        {
            var ModeratorName = "ignat andrei";
            string newParticipantName = "new participant";
            var roundName = "UseCase2 - Join Table";
            var table = TableFactory.CreateTable(ModeratorName);
            table.AddParticipant(newParticipantName);
            table.BootParticipant(table.ModeratorName, newParticipantName);

        }

And after that? How do I recognize that is a Moderator from a participant?

I must have a layer that recognize that, either from name, either from an ID (because I said that the software is to be put on AD/LDAP , then the name will be unique). However, if I wrote code like that:

 

 table.BootParticipant(ModeratorName, newParticipantName);

Then any part of the software that can find the moderator name could boot any participant – even in the participant the code can be written like this:

table.BootParticipant(table.ModeratorName, newParticipantName);

I need to create a security layer to recognize moderator from participant and , when first adding a moderator, unique identify this moderator over the whole table.

So on the moderator the code will be:

moderator.BootParticipant(table.id, newParticipantName);

So I need now a User class –and a Moderator class – with a function that says: BootParticipant.

The problem is that a regular user is promoted as Moderator in this instruction

var table = TableFactory.CreateTable(ModeratorName);

How this is translated into code ? I am thinking and I will come with a solution next time.