예제 #1
0
 public void RevokeRole(Role role)
 {
     ThrowIfDisabled();
       ThrowIfRoleNotGranted(role);
       Apply(
     new RoleRevokedFromUser(Id, role.Id));
 }
예제 #2
0
 void ThrowIfRoleNotGranted(Role role)
 {
     if (!_roles.Contains(role.Id))
     throw new Exception("Yo bro, this role was never granted in the first place!");
 }
예제 #3
0
 public void GrantRole(Role role)
 {
     ThrowIfDisabled();
       Apply(
     new RoleGrantedToUser(Id, role.Id));
 }