Ejemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Attendee" /> class.
        /// </summary>
        /// <param name="emailAddress">The email address.</param>
        /// <param name="commonName">Name of the common.</param>
        /// <param name="role">The role.</param>
        public Attendee(string emailAddress, string commonName, ParticipantRole role)
            : this("MAILTO:" + emailAddress)
        {
            if (commonName != null)
            {
                CommonName = commonName;
            }

            switch (role)
            {
            case ParticipantRole.Chair:
                Role = "CHAIR";
                break;

            case ParticipantRole.NonParticipant:
                Role = "NON-PARTICIPANT";
                break;

            case ParticipantRole.OptionalParticipant:
                Role = "OPT-PARTICIPANT";
                break;

            case ParticipantRole.RequiredParticipant:
                Role = "REQ-PARTICIPANT";
                break;
            }
        }
        public void Verify_that_when_referenced_DeprecatableThing_Is_not_Deprecated_no_result_is_returned()
        {
            var domainOfExpertise = new DomainOfExpertise
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "SYS",
                IsDeprecated = false
            };

            var person = new Person
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "JD",
                IsDeprecated = false
            };

            var participantRole = new ParticipantRole
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "OBS",
                IsDeprecated = false
            };

            this.participant.Domain.Add(domainOfExpertise);
            this.participant.SelectedDomain = domainOfExpertise;
            this.participant.Person         = person;
            this.participant.Role           = participantRole;

            var results = this.participantRuleChecker.ChecksWhetherAReferencedDeprecatableThingIsDeprecated(this.participant);

            Assert.That(results, Is.Empty);
        }
Ejemplo n.º 3
0
        public void Setup()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;
            this.cache             = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();
            this.navigation        = new Mock <IPanelNavigationService>();
            this.permissionService = new Mock <IPermissionService>();

            this.permissionService.Setup(x => x.CanRead(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <Thing>())).Returns(true);
            this.permissionService.Setup(x => x.CanWrite(It.IsAny <ClassKind>(), It.IsAny <Thing>())).Returns(true);

            this.session = new Mock <ISession>();

            this.siteDir = new SiteDirectory(Guid.NewGuid(), null, this.uri);
            this.person  = new Person(Guid.NewGuid(), this.cache, this.uri)
            {
                ShortName = "test"
            };
            this.personRole      = new PersonRole(Guid.NewGuid(), null, this.uri);
            this.participantRole = new ParticipantRole(Guid.NewGuid(), null, this.uri);
            this.siteDir.ParticipantRole.Add(this.participantRole);
            this.siteDir.PersonRole.Add(this.personRole);

            this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString());
            this.session.Setup(x => x.RetrieveSiteDirectory()).Returns(this.siteDir);
            this.session.Setup(x => x.ActivePerson).Returns(this.person);
            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
        }
        /// <summary>
        /// Find and create missing <see cref="ParticipantPermission"/>
        /// </summary>
        /// <param name="participantRole">
        /// The <see cref="ParticipantRole"/> to find and create <see cref="ParticipantPermission"/>s for.
        /// </param>
        /// <param name="transaction">
        /// The current transaction to the database.
        /// </param>
        private void FindAndCreateMissingParticipantPermissions(ParticipantRole participantRole, NpgsqlTransaction transaction)
        {
            var participantPermissions = this.ParticipantPermissionService.GetShallow(
                transaction,
                TopContainer,
                participantRole.ParticipantPermission,
                new RequestSecurityContext {
                ContainerReadAllowed = true
            }).OfType <ParticipantPermission>().ToList();

            foreach (var classKind in Enum.GetValues(typeof(ClassKind)).Cast <ClassKind>())
            {
                var defaultPermission = this.DefaultPermissionProvider.GetDefaultParticipantPermission(classKind);

                if (defaultPermission == ParticipantAccessRightKind.NONE)
                {
                    var participantPermission = participantPermissions.Find(x => x.ObjectClass == classKind);

                    if (participantPermission == null)
                    {
                        Logger.Debug("Create ParticipantPermission for class {0} for ParticipantRole {1}", classKind, participantRole.Iid);

                        var permission = new ParticipantPermission(Guid.NewGuid(), 0)
                        {
                            ObjectClass = classKind,
                            AccessRight = defaultPermission
                        };

                        participantRole.ParticipantPermission.Add(permission.Iid);
                        this.ParticipantPermissionService.CreateConcept(transaction, TopContainer, permission, participantRole);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void VerifyThatNewRolesAreAdded()
        {
            var viewmodel          = new RoleBrowserViewModel(this.session.Object, this.siteDir, null, this.navigation.Object, null, null);
            var newPersonRole      = new PersonRole(Guid.NewGuid(), null, this.uri);
            var newParticipantRole = new ParticipantRole(Guid.NewGuid(), null, this.uri);

            this.siteDir.PersonRole.Add(newPersonRole);
            this.siteDir.ParticipantRole.Add(newParticipantRole);

            var rev = typeof(Thing).GetProperty("RevisionNumber");

            rev.SetValue(this.siteDir, 3);

            CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated);
            var personRoleRow      = viewmodel.Roles.First();
            var participantRoleRow = viewmodel.Roles.Last();

            Assert.AreEqual(2, personRoleRow.ContainedRows.Count);
            Assert.AreEqual(2, participantRoleRow.ContainedRows.Count);

            this.siteDir.PersonRole.Clear();
            this.siteDir.ParticipantRole.Clear();

            rev.SetValue(this.siteDir, 5);
            CDPMessageBus.Current.SendObjectChangeEvent(this.siteDir, EventKind.Updated);

            Assert.AreEqual(0, personRoleRow.ContainedRows.Count);
            Assert.AreEqual(0, participantRoleRow.ContainedRows.Count);

            viewmodel.Dispose();
        }
        public void VerifyThatPropertiesAreSetProperly()
        {
            var participantRole = new ParticipantRole(Guid.NewGuid(), null, this.uri)
            {
                Container = this.siteDir
            };
            var person = new Person(Guid.NewGuid(), null, this.uri)
            {
                Container = this.siteDir
            };
            var participant = new Participant(Guid.NewGuid(), null, this.uri)
            {
                Container = this.siteDir,
                Person    = person,
                Role      = participantRole
            };
            var engModelSetup = new EngineeringModelSetup(Guid.NewGuid(), null, this.uri);

            engModelSetup.Participant.Add(participant);
            this.siteDir.Model.Add(engModelSetup);
            var personRow = new PersonRowViewModel(person, this.session.Object, null);

            Assert.AreEqual(personRow.GivenName, person.GivenName);
            Assert.AreEqual(personRow.Surname, person.Surname);
            Assert.AreEqual(1, personRow.ContainedRows.Count);
        }
        public void VerifyPopulateParticipantPermissions()
        {
            var participantRole = new ParticipantRole();

            Assert.AreEqual(48, participantRole.ParticipantPermission.Count);
            Assert.IsTrue(participantRole.ParticipantPermission.All(x => x.AccessRight == ParticipantAccessRightKind.NONE));
        }
Ejemplo n.º 8
0
        public GroupClassBuilder AddParticipant(Action <UserBuilder> userBuilder, ParticipantRole participantRole, Action <PassBuilder> passBuilder)
        {
            var roleName = Roles.Participant;

            var user = BuildUserWithRole(userBuilder, roleName);

            PassBuilder pass = new PassBuilder(Context);

            passBuilder.Invoke(pass);
            pass.WithStartDate(State.StartClasses)
            .WithParticipant(user);

            ParticipantGroupClass participantGroupClass = new ParticipantGroupClass()
            {
                UserId     = user.Id,
                User       = user,
                GroupClass = State,
                Role       = participantRole
            };

            pass.WithParticipantGroupClass(participantGroupClass);
            participantGroupClass.Passes.Add(pass.Build());
            State.Participants.Add(participantGroupClass);
            return(this);
        }
        public async Task <ParticipantRole> CreateAsync(ParticipantRole item)
        {
            var result = await _context.ParticipantRoles.AddAsync(item);

            await _context.SaveChangesAsync();

            return(result.Entity);
        }
Ejemplo n.º 10
0
        public async Task <ParticipantRole> GetParticipantRoleByIdAsync(Guid id)
        {
            ParticipantRole pRole = await _participantRoleRepo.GetByIdAsync(id);

            pRole.Participants = await _participantRepo.GetByRoleIdAsync(id);

            return(pRole);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Construct a participant from a VenueService.Participant
 /// </summary>
 /// <param name="participant">VenueService.Participant</param>
 /// <param name="venue"></param>
 internal Participant(VenueService.Participant participant)
 {
     identifier = participant.Identifier;
     name = participant.Name;
     email = participant.Email;
     icon = Utilities.ByteToBitmap(participant.Icon);
     role = ParticipantRole.Other;
 }
        public void Verify_that_when_referenced_DeprecatableThing_Is_Deprecated_result_is_returned()
        {
            var domainOfExpertise = new DomainOfExpertise
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "SYS",
                IsDeprecated = true
            };

            var person = new Person
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "JD",
                IsDeprecated = true
            };

            var participantRole = new ParticipantRole
            {
                Iid          = Guid.Parse("7f1bacf8-9517-44d1-aead-6cf9c3027db7"),
                ShortName    = "OBS",
                IsDeprecated = true
            };

            this.participant.Domain.Add(domainOfExpertise);
            this.participant.SelectedDomain = domainOfExpertise;
            this.participant.Person         = person;
            this.participant.Role           = participantRole;

            var results = this.participantRuleChecker.ChecksWhetherAReferencedDeprecatableThingIsDeprecated(this.participant);

            var first = results.First();

            Assert.That(first.Id, Is.EqualTo("MA-0500"));
            Assert.That(first.Description, Is.EqualTo("The referenced DomainOfExpertise 7f1bacf8-9517-44d1-aead-6cf9c3027db7:SYS in Participant.Domain is deprecated"));
            Assert.That(first.Thing, Is.EqualTo(this.participant));
            Assert.That(first.Severity, Is.EqualTo(SeverityKind.Warning));

            var second = results.ElementAt(1);

            Assert.That(second.Id, Is.EqualTo("MA-0500"));
            Assert.That(second.Description, Is.EqualTo("The referenced DomainOfExpertise 7f1bacf8-9517-44d1-aead-6cf9c3027db7:SYS of Participant.SelectedDomain is deprecated"));
            Assert.That(second.Thing, Is.EqualTo(this.participant));
            Assert.That(second.Severity, Is.EqualTo(SeverityKind.Warning));

            var third = results.ElementAt(2);

            Assert.That(third.Id, Is.EqualTo("MA-0500"));
            Assert.That(third.Description, Is.EqualTo("The referenced Person 7f1bacf8-9517-44d1-aead-6cf9c3027db7:JD of Participant.Person is deprecated"));
            Assert.That(third.Thing, Is.EqualTo(this.participant));
            Assert.That(third.Severity, Is.EqualTo(SeverityKind.Warning));

            var fourth = results.ElementAt(3);

            Assert.That(fourth.Id, Is.EqualTo("MA-0500"));
            Assert.That(fourth.Description, Is.EqualTo("The referenced ParticipantRole 7f1bacf8-9517-44d1-aead-6cf9c3027db7:OBS of Participant.Role is deprecated"));
            Assert.That(fourth.Thing, Is.EqualTo(this.participant));
            Assert.That(fourth.Severity, Is.EqualTo(SeverityKind.Warning));
        }
Ejemplo n.º 13
0
        public void AddParticipant(string address, string name, ParticipantRole role)
        {
            if (this._participants == null)
            {
                _participants = new List <Participant>(1);
            }

            _participants.Add(Participant.Create(address, name, role));
        }
Ejemplo n.º 14
0
        public void UpdateFromRazor(Participant participant, Country country, ParticipantRole role, Gender gender)
        {
            Participant existedParticipant = _context.Participants.Find(participant.ID);

            existedParticipant.Country = _context.Countries.Find(country.ID);
            existedParticipant.Gender  = _context.Genders.Find(gender.ID);
            existedParticipant.Role    = _context.ParticipantRoles.Find(role.ID);

            _context.SaveChanges();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParticipantRoleRowViewModel"/> class.
        /// </summary>
        /// <param name="role">The <see cref="ParticipantRole"/> that is represented by the current row</param>
        /// <param name="session">The session</param>
        /// <param name="containerViewModel">The container <see cref="IViewModelBase{T}"/></param>
        public ParticipantRoleRowViewModel(ParticipantRole role, ISession session, IViewModelBase <Thing> containerViewModel)
            : base(role, session, containerViewModel)
        {
            foreach (var permission in this.Thing.ParticipantPermission.OrderBy(x => x.ObjectClass.ToString()))
            {
                var row = new ParticipantPermissionRowViewModel(permission, this.Session, this);
                this.ContainedRows.Add(row);
            }

            this.ClassKind = this.Thing.ClassKind.ToString();
        }
        public async Task <bool> DeleteAsync(Guid id)
        {
            ParticipantRole pRole = await GetByIdAsync(id);

            if (pRole == null)
            {
                return(false);
            }
            _context.ParticipantRoles.Remove(pRole);
            await _context.SaveChangesAsync();

            return(true);
        }
        public async Task <bool> UpdateAsync(ParticipantRole item)
        {
            ParticipantRole pRole = await GetByIdAsync(item.Id);

            if (pRole == null)
            {
                return(false);
            }
            _context.ParticipantRoles.Update(item);
            await _context.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 18
0
        public GroupClassAggregate AddParticipant(User participant, ParticipantRole role, PassAggregate passAggregate)
        {
            ParticipantGroupClass participantGroupClass = new ParticipantGroupClass()
                                                          .WithUser(participant)
                                                          .WithGroupClass(State) as ParticipantGroupClass;

            participantGroupClass.WithRole(role);
            participantGroupClass.Passes.Add(passAggregate.State);

            State.Participants.Add(participantGroupClass);

            AddParticipantToPresenceList(participant, PresenceType.Member);
            return(this);
        }
Ejemplo n.º 19
0
        public void SetUp()
        {
            this.participantRoleRuleChecker = new ParticipantRoleRuleChecker();

            this.participantRole = new ParticipantRole();

            this.participantPermission = new ParticipantPermission
            {
                Iid         = Guid.Parse("450ef9fb-fc60-4dab-a203-4340f0181102"),
                ObjectClass = ClassKind.Person
            };

            this.participantRole.ParticipantPermission.Add(this.participantPermission);
        }
Ejemplo n.º 20
0
 public async Task <ActionResult <ParticipantRole> > Post([FromBody] ParticipantRole item)
 {
     try
     {
         if (item == null)
         {
             return(BadRequest());
         }
         return(Ok(await _supervisor.CreateParticipantRoleAsync(item)));
     }
     catch (Exception ex)
     {
         return(StatusCode(500, ex));
     }
 }
Ejemplo n.º 21
0
        public void VerifyThatRoleAndPermissionAreFilteredCorrectly()
        {
            var personRole      = new PersonRole(Guid.NewGuid(), 0);
            var participantRole = new ParticipantRole(Guid.NewGuid(), 0);

            this.personPermission1             = new PersonPermission(Guid.NewGuid(), 0);
            this.personPermission1.ObjectClass = ClassKind.ActionItem;
            this.personPermission2             = new PersonPermission(Guid.NewGuid(), 0);
            this.personPermission2.ObjectClass = ClassKind.SiteDirectory;
            this.personPermission3             = new PersonPermission(Guid.NewGuid(), 0);
            this.personPermission3.ObjectClass = ClassKind.ActualFiniteState;

            this.participantPermission1             = new ParticipantPermission(Guid.NewGuid(), 0);
            this.participantPermission1.ObjectClass = ClassKind.DiagramCanvas;
            this.participantPermission2             = new ParticipantPermission(Guid.NewGuid(), 0);
            this.participantPermission2.ObjectClass = ClassKind.EngineeringModel;
            this.participantPermission3             = new ParticipantPermission(Guid.NewGuid(), 0);
            this.participantPermission3.ObjectClass = ClassKind.ElementDefinition;

            personRole.PersonPermission.Add(this.personPermission3.Iid);
            personRole.PersonPermission.Add(this.personPermission2.Iid);
            personRole.PersonPermission.Add(this.personPermission1.Iid);

            participantRole.ParticipantPermission.Add(this.participantPermission1.Iid);
            participantRole.ParticipantPermission.Add(this.participantPermission2.Iid);
            participantRole.ParticipantPermission.Add(this.participantPermission3.Iid);

            var input = new List <Thing>
            {
                personRole,
                participantRole,
                this.personPermission1,
                this.personPermission2,
                this.personPermission3,
                this.participantPermission1,
                this.participantPermission2,
                this.participantPermission3
            };

            var result = this.service.FilterOutPermissions(
                input,
                new Version(1, 0)).ToArray();

            Assert.IsFalse(result.Contains(this.personPermission1));
            Assert.IsFalse(result.Contains(this.participantPermission1));
            Assert.AreEqual(personRole.PersonPermission.Count, 2);
            Assert.AreEqual(participantRole.ParticipantPermission.Count, 2);
        }
Ejemplo n.º 22
0
        private static List <GroupUser> GetUsers(IFormFile file)
        {
            List <GroupUser> users = new List <GroupUser>();

            using (var stream = file.OpenReadStream())
            {
                stream.Position = 0;
                string sFileExtension = Path.GetExtension(file.FileName).ToLower();
                ISheet sheet;
                if (sFileExtension == ".xls")
                {
                    HSSFWorkbook hssfwb = new HSSFWorkbook(stream); //This will read the Excel 97-2000 formats
                    sheet = hssfwb.GetSheetAt(0);                   //get first sheet from workbook
                }
                else
                {
                    XSSFWorkbook hssfwb = new XSSFWorkbook(stream); //This will read 2007 Excel format
                    sheet = hssfwb.GetSheetAt(0);                   //get first sheet from workbook
                }

                for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++) //Read Excel File
                {
                    IRow row = sheet.GetRow(i);
                    if (row == null)
                    {
                        continue;
                    }
                    if (row.Cells.All(d => d.CellType == CellType.Blank))
                    {
                        continue;
                    }
                    ParticipantRole participantRole = Enum.Parse <ParticipantRole>(GetCellValue(row, 5));
                    GroupUser       user            = new GroupUser
                    {
                        FirstName    = GetCellValue(row, 0),
                        LastName     = GetCellValue(row, 1),
                        Email        = GetCellValue(row, 2),
                        PhoneNumber  = GetCellValue(row, 3),
                        FacebookLink = GetCellValue(row, 4),
                        Role         = participantRole
                    };

                    users.Add(user);
                }
            }

            return(users);
        }
        public void Setup()
        {
            RxApp.MainThreadScheduler  = Scheduler.CurrentThread;
            this.thingDialogNavigation = new Mock <IThingDialogNavigationService>();
            this.permissionService     = new Mock <IPermissionService>();
            this.session         = new Mock <ISession>();
            this.siteDir         = new SiteDirectory(Guid.NewGuid(), null, this.uri);
            this.participantRole = new ParticipantRole(Guid.NewGuid(), null, this.uri)
            {
                Name = "aa"
            };
            this.siteDir.ParticipantRole.Add(this.participantRole);
            this.session.Setup(x => x.DataSourceUri).Returns(this.uri.ToString());

            this.session.Setup(x => x.PermissionService).Returns(this.permissionService.Object);
        }
Ejemplo n.º 24
0
        public async Task <ActionResult <ParticipantRole> > Get(Guid id)
        {
            try
            {
                ParticipantRole pRole = await _supervisor.GetParticipantRoleByIdAsync(id);

                if (pRole == null)
                {
                    return(NotFound());
                }
                return(Ok(pRole));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
Ejemplo n.º 25
0
        public static string ToFriendlyString(this ParticipantRole me)
        {
            switch (me)
            {
            case ParticipantRole.TO:
                return("to");

            case ParticipantRole.CC:
                return("cc");

            case ParticipantRole.FROM:
                return("from");

            default:
                return("");
            }
        }
Ejemplo n.º 26
0
        public async Task <ActionResult <List <ParticipantDto> > > GetByRole(Guid id)
        {
            try
            {
                ParticipantRole role = await _supervisor.GetParticipantRoleByIdAsync(id);

                if (role == null)
                {
                    return(NotFound());
                }
                return(Ok(await _supervisor.GetParticipantByRoleIdAsync(id)));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex));
            }
        }
        public void SetUp()
        {
            RxApp.MainThreadScheduler = Scheduler.CurrentThread;

            this.cache = new ConcurrentDictionary <CacheKey, Lazy <Thing> >();
            this.url   = new Uri("http://www.rheagroup.com");

            this.session                      = new Mock <ISession>();
            this.permissionService            = new Mock <IPermissionService>();
            this.thingDialogNavigationService = new Mock <IThingDialogNavigationService>();

            this.domainOfExpertise1 = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.url)
            {
                ShortName = "SYS"
            };
            this.domainOfExpertise2 = new DomainOfExpertise(Guid.NewGuid(), this.cache, this.url)
            {
                ShortName = "THR"
            };

            this.organization           = new Organization(Guid.NewGuid(), this.cache, this.url);
            this.organization.ShortName = "RHEA";
            this.organization.Name      = "RHEA";

            this.personRole = new PersonRole(Guid.NewGuid(), this.cache, this.url);
            this.person     = new Person(Guid.NewGuid(), this.cache, this.url)
            {
                OrganizationalUnit = "SESS",
                Organization       = this.organization,
                Role = this.personRole
            };

            this.participantRole      = new ParticipantRole(Guid.NewGuid(), this.cache, this.url);
            this.participant          = new Participant(Guid.NewGuid(), this.cache, this.url);
            this.participant.Person   = this.person;
            this.participant.Role     = this.participantRole;
            this.participant.IsActive = true;

            this.participant.Domain.Add(this.domainOfExpertise1);
            this.participant.Domain.Add(this.domainOfExpertise2);


            this.session.Setup(x => x.DataSourceUri).Returns(this.url.ToString);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Serialize the <see cref="ParticipantRole"/>
        /// </summary>
        /// <param name="participantRole">The <see cref="ParticipantRole"/> to serialize</param>
        /// <returns>The <see cref="JObject"/></returns>
        private JObject Serialize(ParticipantRole participantRole)
        {
            var jsonObject = new JObject();

            jsonObject.Add("alias", this.PropertySerializerMap["alias"](participantRole.Alias.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("classKind", this.PropertySerializerMap["classKind"](Enum.GetName(typeof(CDP4Common.CommonData.ClassKind), participantRole.ClassKind)));
            jsonObject.Add("definition", this.PropertySerializerMap["definition"](participantRole.Definition.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedDomain", this.PropertySerializerMap["excludedDomain"](participantRole.ExcludedDomain.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("excludedPerson", this.PropertySerializerMap["excludedPerson"](participantRole.ExcludedPerson.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("hyperLink", this.PropertySerializerMap["hyperLink"](participantRole.HyperLink.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("iid", this.PropertySerializerMap["iid"](participantRole.Iid));
            jsonObject.Add("isDeprecated", this.PropertySerializerMap["isDeprecated"](participantRole.IsDeprecated));
            jsonObject.Add("modifiedOn", this.PropertySerializerMap["modifiedOn"](participantRole.ModifiedOn));
            jsonObject.Add("name", this.PropertySerializerMap["name"](participantRole.Name));
            jsonObject.Add("participantPermission", this.PropertySerializerMap["participantPermission"](participantRole.ParticipantPermission.OrderBy(x => x, this.guidComparer)));
            jsonObject.Add("revisionNumber", this.PropertySerializerMap["revisionNumber"](participantRole.RevisionNumber));
            jsonObject.Add("shortName", this.PropertySerializerMap["shortName"](participantRole.ShortName));
            jsonObject.Add("thingPreference", this.PropertySerializerMap["thingPreference"](participantRole.ThingPreference));
            return(jsonObject);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Populates the <see cref="ParticipantPermission"/> property with the content of the actual thing and the content of the transaction
        /// </summary>
        protected override void PopulateParticipantPermission()
        {
            this.ParticipantPermission.Clear();
            var participantRoleWithAllPermissions = new ParticipantRole {
                Container = this.Container
            };

            foreach (var participantPermission in participantRoleWithAllPermissions.ParticipantPermission.Where(t => t.ChangeKind != ChangeKind.Delete))
            {
                var permissionObjectClassVersion = new Version(this.metadataProvider.GetClassVersion(participantPermission.ObjectClass.ToString()));
                if (!this.Session.IsVersionSupported(permissionObjectClassVersion))
                {
                    continue;
                }

                var permissionToAdd = this.Thing.ParticipantPermission.SingleOrDefault(x => x.ObjectClass == participantPermission.ObjectClass) ?? participantPermission;
                var row             = new CDP4CommonView.ParticipantPermissionRowViewModel(permissionToAdd, this.Session, this);
                this.ParticipantPermission.Add(row);
            }
        }
        public void SetUp()
        {
            this.siteDirectoryRuleChecker = new SiteDirectoryRuleChecker();

            this.siteDirectory = new SiteDirectory();
            this.personRole    = new PersonRole
            {
                Iid       = Guid.Parse("c9e4beec-1b97-4c33-aaea-b8468610af3e"),
                ShortName = "TL"
            };
            this.participantRole = new ParticipantRole
            {
                Iid       = Guid.Parse("3e9d77bd-3cc4-4b21-af99-fafd2f4cf64a"),
                ShortName = "DE"
            };

            this.siteDirectory.PersonRole.Add(this.personRole);
            this.siteDirectory.ParticipantRole.Add(this.participantRole);
            this.siteDirectory.DefaultPersonRole      = this.personRole;
            this.siteDirectory.DefaultParticipantRole = this.participantRole;
        }
Ejemplo n.º 31
0
        public void Authenticate(ParticipantRole role, string pin)
        {
            var cmd = new CodecCommand("Conference/Call", "AuthenticationResponse");

            cmd.Args.Add("CallId", Id);
            cmd.Args.Add(role);
            if (!string.IsNullOrEmpty(pin))
            {
                cmd.Args.Add("Pin", pin);
            }
            var response = Codec.SendCommand(cmd);

#if DEBUG
            Debug.WriteInfo("Response from authenticate", response.Code.ToString());

            if (response.Xml != null)
            {
                Debug.WriteNormal(response.Xml.ToString());
            }
#endif
        }