Esempio n. 1
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            if (CmdSite == null || CmdPortal == null)
            {
                return;
            }
            ;
            WriteVerbose(string.Format("delete-role on {0} portal {1}", CmdSite.Url, CmdPortal.PortalId));
            var response = RoleCommands.DeleteRole(CmdSite, CmdPortal.PortalId, RoleId);

            WriteObject(response);
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            if (CmdSite == null || CmdPortal == null)
            {
                return;
            }
            ;
            WriteVerbose(string.Format("set-role on {0} portal {1}", CmdSite.Url, CmdPortal.PortalId));
            var response = RoleCommands.SetRole(CmdSite, CmdPortal.PortalId, RoleId, RoleName, Description, Public, AutoAssign, Common.Globals.ToEnum(Status, RoleCommands.RoleStatus.Approved));

            WriteObject(response);
        }
Esempio n. 3
0
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            if (CmdSite == null || CmdPortal == null)
            {
                return;
            }
            ;
            WriteVerbose(string.Format("list-roles on {0} portal {1}", CmdSite.Url, CmdPortal.PortalId));
            var response = RoleCommands.ListRoles(CmdSite, CmdPortal.PortalId);

            WriteArray(response);
        }
Esempio n. 4
0
        public void BuildRelationship()
        {
            foreach (var rg in RoomGroups)
            {
                rg.SubRoomGroups = new List <RoomGroup>();
                rg.SubRoomGroups.AddRange(RoomGroups.Where(g => g.ParentGroup_Id.HasValue && g.ParentGroup_Id.Value == rg.Id));
                rg.Rooms = Rooms.Where(r => r.RoomGroup_Id == rg.Id).ToList();
            }
            GiftGroups.ForEach(giftGroup =>
            {
                giftGroup.Gifts = Gifts.Where(g => g.GiftGroup_Id == giftGroup.Id).ToList();
            });
            foreach (var room in Rooms)
            {
                room.RoomRoles = new List <RoomRole>();
                var rrs = RoomRoles.Where(r => r.Room_Id == room.Id);
                if (rrs != null)
                {
                    room.RoomRoles.AddRange(rrs);
                }
            }
            foreach (var role in Roles)
            {
                if (role.Application_Id == applicationId || role.Application_Id == BuiltIns.AllApplication.Id)
                {
                    role.RoleCommands = new List <RoleCommandView>();
                    var rcs = RoleCommands.Where(rc => (rc.SourceRole_Id == role.Id || rc.SourceRole_Id == BuiltIns.AllRole.Id) &&
                                                 (rc.Application_Id == applicationId || rc.Application_Id == BuiltIns.AllApplication.Id));

                    if (rcs != null)
                    {
                        role.RoleCommands.AddRange(rcs);
                    }
                }
            }
        }