예제 #1
0
        public void UnknownAccessTokenThrowsArgumentException()
        {
            var settings = new CoreSettings();

            var accessControl = new AccessControl(settings);

            Assert.Throws<ArgumentException>(() => accessControl.VerifyAccess(new Guid()));
        }
예제 #2
0
        public void RegisterVoteForSameEntryThrowsInvalidOperationException()
        {
            var settings = new CoreSettings { MaxVoteCount = 2 };
            var accessControl = new AccessControl(settings);
            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            var entry = SetupVotedEntry();

            accessControl.RegisterVote(token, entry);
            entry.Vote();
            Assert.Throws<InvalidOperationException>(() => accessControl.RegisterVote(token, entry));
        }
예제 #3
0
        public void UnlockedRemoteControlGivesAdminRightsByDefault()
        {
            var settings = new CoreSettings
            {
                LockRemoteControl = false
            };

            var accessControl = new AccessControl(settings);

            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            accessControl.VerifyAccess(token);
        }
예제 #4
0
        public void LockedRemoteControlGivesGuestRightsByDefault()
        {
            var settings = new CoreSettings
            {
                LockRemoteControl = true,
                RemoteControlPassword = "******"
            };

            var accessControl = new AccessControl(settings);

            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            Assert.Throws<AccessException>(() => accessControl.VerifyAccess(token));
        }
예제 #5
0
    protected void ImageButtonLogin_Click(object sender, ImageClickEventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Login"))
        {
            LabelLoginError.Text = "با عرض پوزش ورود به سیستم موقتاً در سایت غیر فعال می باشد.";
            LabelLoginError.Visible = true;
        }
        else
        {
            string loginEmail = TextBoxLoginEmail.Text;

            MD5CryptoServiceProvider md5Hasher = new MD5CryptoServiceProvider();
            Byte[] PassByte;
            UTF8Encoding encoder = new UTF8Encoding();
            PassByte = md5Hasher.ComputeHash(encoder.GetBytes(TextBoxLoginPassword.Text));

            var query = context.Users.Where(u => u.Email == loginEmail && u.Password == PassByte).SingleOrDefault();
            if (query != null)
            {
                LabelLoginError.Visible = false;
                Session["UserId"] = query.UserId;

                int Hours = 2;
                string VerificationCode = Convert.ToString(Guid.NewGuid());

                if (CheckBoxLoginRemember.Checked)
                {
                    Hours = 168;
                }

                LoginSession ls = new LoginSession();
                ls.setLoginSession(Convert.ToInt32(query.UserId), VerificationCode, Hours);

                HttpCookie _userInfoCookies = new HttpCookie("VC");
                _userInfoCookies["VC"] = VerificationCode;
                _userInfoCookies.Expires = DateTime.Now.AddHours(Hours);
                Response.Cookies.Add(_userInfoCookies);

                query.LastLogin = DateTime.Now;
                context.SubmitChanges();

                Response.Redirect("~/Panel.aspx");
            }
            else
            {
                LabelLoginError.Visible = true;
            }
        }
    }
예제 #6
0
        public void RegisteredVoteUnregistersAutomaticallyWhenEntryvoteCountIsReset()
        {
            var settings = new CoreSettings { MaxVoteCount = 2 };
            var accessControl = new AccessControl(settings);
            Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

            var entry = new PlaylistEntry(0, Helpers.SetupSongMock());
            entry.Vote();

            var votes = accessControl.ObserveRemainingVotes(token).CreateCollection();
            accessControl.RegisterVote(token, entry);

            entry.ResetVotes();

            Assert.Equal(new int?[] { 2, 1, 2 }, votes);
        }
예제 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Charity"))
        {
            Response.Redirect("~/Error.aspx?Code=NoAccess");
        }

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_charityNewsInfo", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@NewsId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsId"]);
        sda.Fill(ds);
        dt = ds.Tables[0];

        if (dt.Rows.Count == 0) //news doesn't exist
        {
            Response.Redirect("~/Charity.aspx");
        }
        else //news exists
        {
            LabelTitle.Text = dt.Rows[0]["Subject"].ToString();
            DateTime NewsDate = Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString());
            PersianCalendar pc = new PersianCalendar();
            string year = pc.GetYear(NewsDate).ToString();
            string Mounth = pc.GetMonth(NewsDate).ToString();
            string Day = pc.GetDayOfMonth(NewsDate).ToString();

            LabelDate.Text = year + "/" + Mounth + "/" + Day;

            LabelBody.Text = dt.Rows[0]["Body"].ToString();
            ImageImage.ImageUrl = "~/images/charity/news/" + Request.QueryString["NewsId"] + ".png";
            Page.Title = "Salestan : اخبار خیریه : " + dt.Rows[0]["Subject"].ToString();


            HyperLinkShareFacebook.NavigateUrl = "http://www.facebook.com/share.php?u=" + Request.Url.AbsoluteUri + "&t=" + dt.Rows[0]["Subject"].ToString();
            HyperLinkShareTwitter.NavigateUrl = "http://twitter.com/home?status=" + dt.Rows[0]["Subject"].ToString() + " " + Request.Url.AbsoluteUri;
            HyperLinkShareEmail.NavigateUrl = "mailto:?subject=" + dt.Rows[0]["Subject"].ToString() + "&body=" + Request.Url.AbsoluteUri;
            HyperLinkSharePrint.NavigateUrl = "~/Print.aspx?Mode=CharityNews&ItemId=" + Request.QueryString["NewsId"];
        }
        sda.Dispose();
        sqlConn.Close();
    }
예제 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Offers"))
        {
            Response.Redirect("~/Error.aspx?Code=NoAccess");
        }

        PanelError.Visible = false;

        SqlDataSourceOffers.SelectParameters.Add("Date", DateTime.Now.ToString());
        SqlDataSourceOffers.SelectParameters.Add("Language", "fa");
        SqlDataSourceOffers.SelectParameters.Add("Location", "0");

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);
        SqlDataAdapter sda = new SqlDataAdapter("SELECT OfferId, EndDate FROM Offers WHERE (EndDate > GETDATE()) AND (ShowDate < GETDATE()) ORDER BY ShowDate", sqlConn);
        sda.SelectCommand.CommandType = CommandType.Text;
        sda.Fill(ds);
        dt = ds.Tables[0];

        StringBuilder sb = new StringBuilder();
        sb.AppendLine("<script type=\"text/javascript\">");
        sb.AppendLine("    jq17(document).ready(function () {");

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            sb.AppendLine("        jq17(\"#time" + dt.Rows[i]["OfferId"].ToString() + "\").countdown({");
            sb.AppendLine("            date: \"" + getEndDate(dt.Rows[i]["EndDate"].ToString()) + "\",");
            sb.AppendLine("            onComplete: function (event) {");
            sb.AppendLine("                jq17(this).html(\"&#1662;&#1575;&#1740;&#1575;&#1606; &#1740;&#1575;&#1601;&#1578;\");");
            sb.AppendLine("            },");
            sb.AppendLine("            leadingZero: true");
            sb.AppendLine("        });");
        }
        sb.AppendLine("    });");
        sb.AppendLine("</script>");

        LiteralTimes.Text = sb.ToString();

        if (dt.Rows.Count == 0) //offer doesn't exist
        {
            PanelError.Visible = true;
        }
    }
예제 #9
0
        public Library(ILibraryReader libraryReader, ILibraryWriter libraryWriter, CoreSettings settings,
            IFileSystem fileSystem, Func<string, ILocalSongFinder> localSongFinderFunc = null)
        {
            if (libraryReader == null)
                throw new ArgumentNullException("libraryReader");

            if (libraryWriter == null)
                throw new ArgumentNullException("libraryWriter");

            if (settings == null)
                throw new ArgumentNullException("settings");

            if (fileSystem == null)
                throw new ArgumentNullException("fileSystem");

            this.libraryReader = libraryReader;
            this.libraryWriter = libraryWriter;
            this.settings = settings;
            this.fileSystem = fileSystem;
            this.localSongFinderFunc = localSongFinderFunc ?? (x => new LocalSongFinder(x));

            this.globalSubscriptions = new CompositeDisposable();
            this.accessControl = new AccessControl(settings);
            this.songLock = new ReaderWriterLockSlim();
            this.songs = new HashSet<LocalSong>();
            this.playlists = new ReactiveList<Playlist>();
            this.songsUpdated = new Subject<Unit>();
            this.audioPlayer = new AudioPlayer();
            this.manualUpdateTrigger = new Subject<Unit>();

            this.LoadedSong = this.audioPlayer.LoadedSong;
            this.TotalTime = this.audioPlayer.TotalTime;
            this.PlaybackState = this.audioPlayer.PlaybackState;

            this.WhenAnyValue(x => x.CurrentPlaylist.CanPlayNextSong).SampleAndCombineLatest(this.audioPlayer.PlaybackState
                    .Where(p => p == AudioPlayerState.Finished), (canPlayNextSong, _) => canPlayNextSong)
                .SelectMany(x => this.HandleSongFinishAsync(x).ToObservable())
                .Subscribe();

            this.CurrentPlaybackTime = this.audioPlayer.CurrentTimeChanged;

            this.volume = this.settings.WhenAnyValue(x => x.Volume)
                .ToProperty(this, x => x.Volume);
        }
예제 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Credit"))
        {
            PanelAll.Visible = false;
            PanelNoAccess.Visible = true;
            Response.End();
        }

        //check login status
        CheckLogin cl = new CheckLogin();
        bool LoginStatus = cl.checkLogin(Convert.ToInt32(Session["UserId"]));
        if (!LoginStatus)
        {
            Response.Redirect("Login.aspx?Page=Credit");
        }

        try
        {
            switch (Request.QueryString["Mode"])
            {
                case "TransactionSuccessful":
                    {
                        PanelResult.Visible = true;
                        PanelTransactionSuccessful.Visible = true;
                        LabelSuccessfulCode.Text = Request.QueryString["TransactionId"].ToString();
                        break;
                    }
                case "TransactionFailed":
                    {
                        PanelResult.Visible = true;
                        PanelTransactionFailed.Visible = true;
                        LabelFailedCode.Text = Request.QueryString["TransactionId"].ToString();
                        break;
                    }
            }
        }
        catch (Exception)
        {
            throw;
        }
    }
예제 #11
0
 public static void get_Description(AccessControl obj, PropertyGetterEventArgs<string> e)
 {
     if (obj is GroupMembership)
     {
         var grp = (GroupMembership)obj;
         e.Result = string.Format("Group {0} has {1} rights", grp.Group != null ? grp.Group.Name : "<null>", obj.Rights);
     }
     else if (obj is RoleMembership)
     {
         var role = (RoleMembership)obj;
         var navigators = new List<string>();
         ObjectClass nextType = obj.ObjectClass;
         foreach (var rel in role.Relations)
         {
             if (rel == null)
             {
                 // Only during dehydration - fix this call!
                 continue;
             }
             if (rel.A != null && rel.A.Type == nextType)
             {
                 navigators.Add(rel.A.Navigator != null ? rel.A.Navigator.Name : "<?>");
                 nextType = rel.B.Type;
             }
             else if (rel.B != null && rel.B.Type == nextType)
             {
                 navigators.Add(rel.B.Navigator != null ? rel.B.Navigator.Name : "<?>");
                 nextType = rel.A.Type;
             }
             else
             {
                 navigators.Add("<?>");
             }
         }
         e.Result = string.Format("{0} has {1} rights", string.Join(".", navigators), obj.Rights);
     }
 }
예제 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Charity"))
        {
            Response.Redirect("~/Error.aspx?Code=NoAccess");
        }

        var Lst = context.CharityNews.OrderBy(s => s.SubmitDate).Take(3).ToArray();
   
        HiddenFieldH1.Value=  Lst[0].Subject;
        HiddenFieldH2.Value = Lst[1].Subject;
        HiddenFieldH3.Value = Lst[2].Subject;
        HiddenFieldP1.Value = Lst[0].Brief;
        HiddenFieldP2.Value = Lst[1].Brief;
        HiddenFieldP3.Value = Lst[2].Brief;
        HiddenFieldId1.Value =  Lst[0].NewsId.ToString();
        HiddenFieldId2.Value =  Lst[1].NewsId.ToString();
        HiddenFieldId3.Value =  Lst[2].NewsId.ToString();



      
    }
예제 #13
0
            public void WithBogusAccessTokenThrowsArgumentException()
            {
                var settings = new CoreSettings
                {
                    RemoteControlPassword = "******"
                };

                var accessControl = new AccessControl(settings);

                Assert.Throws<ArgumentException>(() => accessControl.UpgradeRemoteAccess(new Guid(), "password123"));
            }
예제 #14
0
            public void ThrowsWrongPasswordExceptionOnWrongPassword()
            {
                var settings = new CoreSettings
                {
                    RemoteControlPassword = "******"
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<WrongPasswordException>(() => accessControl.UpgradeRemoteAccess(token, "lolol"));
            }
예제 #15
0
            public void ThrowsWrongPasswordExceptionOnWrongPassword()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();
                accessControl.SetLocalPassword(token, "password123");

                Assert.Throws<WrongPasswordException>(() => accessControl.UpgradeLocalAccess(token, "lolol"));
            }
 public SOWImportExcelHandler(GlobalSolusindoDb db, tblM_User user, SOWValidator SOWValidator, SOWFactory SOWFactory, SOWAssignFactory sOWAssignFactory, SOWQuery SOWQuery, AccessControl accessControl) : base(db, user)
 {
     this.SOWValidator         = SOWValidator;
     this.SOWFactory           = SOWFactory;
     this.SOWQuery             = SOWQuery;
     this.SOWAssignFactory     = sOWAssignFactory;
     this.SOWEntryDataProvider = new SOWEntryDataProvider(db, user, accessControl, SOWQuery);
     //((IObjectContextAdapter)Db).ObjectContext.CommandTimeout = 300; //set time out
     //db.Database.CommandTimeout = 300;
 }
        //REMEMBER TO NOT ALLOW THE USERS TO CHECK IN AFTER 18:00, THEY MUST LOG AN OVERTIME TICKET INSTEAD


        public EmployeeController(IConfiguration config, AccessControl context)
        {
            _config  = config;
            _context = context;
        }
 public HttpResponseMessage GetIncompleteRxByPatientId(int patientId)
 {
     AccessControl.VerifyUserAccessToPatient(patientId);
     return(this.Request.CreateResponse(HttpStatusCode.OK, this.contactLensOrderIt2Manager.GetIncompleteRxByPatientId(patientId, this.companyId, this.officeNumber)));
 }
예제 #19
0
        /// <summary>
        /// //���ʿ�����Ϣ��ȡ��
        /// </summary>
        /// <returns></returns>
        private bool GetAccessControlInformation(AccessControl AccessInformation)
        {
            if (AccessInformation.LimitServer)
            {

                if (string.IsNullOrEmpty(AccessInformation.SVDBServer))
                {
                    return false;
                }
            }

            if (AccessInformation.LimitUser)
            {

                if (string.IsNullOrEmpty(AccessInformation.UserID))
                {
                    return false;
                }
            }

            return true;
        }
 public SOWTrackResultCreateHandler(GlobalSolusindoDb db, tblM_User user, SOWTrackResultValidator sowTrackResultValidator, SOWTrackResultFactory sowTrackResultFactory, SOWTrackResultQuery sowTrackResultQuery, AccessControl accessControl) : base(db, user)
 {
     this.sowTrackResultValidator         = sowTrackResultValidator;
     this.sowTrackResultFactory           = sowTrackResultFactory;
     this.sowTrackResultQuery             = sowTrackResultQuery;
     this.sowTrackResultEntryDataProvider = new SOWTrackResultEntryDataProvider(db, user, accessControl, sowTrackResultQuery);
 }
 public VendorEntryControlBuilder(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl) : base(db, user)
 {
     this.accessControl = accessControl;
 }
예제 #22
0
 public VisitorController(AccessControl context, IConfiguration configuration, IWebHostEnvironment hosting)
 {
     _context = context;
     _config  = configuration;
     _hosting = hosting;
 }
예제 #23
0
 public UserCreateHandler(GlobalSolusindoDb db, tblM_User user, UserValidator userValidator, UserFactory userFactory, UserQuery userQuery, AccessControl accessControl) : base(db, user)
 {
     this.userValidator         = userValidator;
     this.userFactory           = userFactory;
     this.userQuery             = userQuery;
     this.accessControl         = accessControl;
     this.userEntryDataProvider = new UserEntryDataProvider(db, user, accessControl, userQuery);
     MapJabatanToRoleGroup();
 }
예제 #24
0
        /// <summary>
        /// Método de processamentoda requisição
        /// </summary>
        /// <param name="sqlConnection">Conexão com o banco de dados MS-SQL</param>
        /// <param name="enterpriseId">ID da empresa</param>
        /// <param name="method">String com o método que deverá ser processado</param>
        /// <param name="auth">String com a chave de autenticação.</param>
        /// <param name="parameters">Dicionário (String, Object) contendo todos os parâmetros necessários</param>
        public override Object Process(SqlConnection sqlConnection, Int64 enterpriseId, String method, String auth, Dictionary <String, Object> parameters)
        {
            this._enterpriseId = enterpriseId;
            base.Connection    = sqlConnection;

            method = method.ToLower();
            String[] mp = method.Split(".".ToCharArray(), 2);

            if (mp.Length != 2)
            {
                return(null);
            }

            if (this.GetType().Name.ToLower() != mp[0])
            {
                return(null);
            }

            AccessControl ac = ValidateCtrl(sqlConnection, method, auth, parameters, ExternalAccessControl);

            if (!ac.Result)
            {
                Error(ErrorType.InvalidParameters, "Not authorized", "", null);
                return(null);
            }

            switch (mp[1])
            {
            case "new":
                return(newfield(sqlConnection, parameters));

                break;

            case "get":
                return(get(sqlConnection, parameters));

                break;

            case "list":
            case "search":
                return(list(sqlConnection, parameters));

                break;

            case "change":
                return(change(sqlConnection, parameters));

                break;

            case "delete":
                return(delete(sqlConnection, parameters));

                break;

            default:
                Error(ErrorType.InvalidRequest, "JSON-rpc method is unknow.", "", null);
                return(null);

                break;
            }

            return(null);
        }
 public IssueTypeEntryDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl, IssueTypeQuery issueTypeQuery) : base(db, user)
 {
     this.accessControl  = accessControl;
     this.issueTypeQuery = issueTypeQuery;
 }
예제 #26
0
            public void LocalSmokeTest()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.VerifyAccess(token, false);

                accessControl.SetLocalPassword(token, "password123");
                accessControl.DowngradeLocalAccess(token);

                Assert.Throws<AccessException>(() => accessControl.VerifyAccess(token));
            }
 public UserDetailUpdateHandler(GlobalSolusindoDb db, tblM_User user, UserDetailValidator userDetailValidator, UserDetailFactory userDetailFactory, UserDetailQuery userDetailQuery, AccessControl accessControl) : base(db, user)
 {
     this.userDetailValidator         = userDetailValidator;
     this.userDetailFactory           = userDetailFactory;
     this.userDetailQuery             = userDetailQuery;
     this.userDetailEntryDataProvider = new UserDetailEntryDataProvider(db, user, accessControl, userDetailQuery);
 }
 public TaskEngineerDetailDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl) : base(db, user)
 {
     this.accessControl = accessControl;
 }
예제 #29
0
            public void WithoutVotesLeftThrowsInvalidOperationException()
            {
                var settings = new CoreSettings
                {
                    EnableVotingSystem = true,
                    MaxVoteCount = 0
                };
                var accessControl = new AccessControl(settings);
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<InvalidOperationException>(() => accessControl.RegisterVote(token, new PlaylistEntry(0, Helpers.SetupSongMock())));
            }
예제 #30
0
 public SOWResultEntryDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl, SOWResultQuery sowResultQuery) : base(db, user)
 {
     this.accessControl  = accessControl;
     this.sowResultQuery = sowResultQuery;
 }
예제 #31
0
 public CabangEntryDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl, CabangQuery cabangQuery) : base(db, user)
 {
     this.accessControl = accessControl;
     this.cabangQuery   = cabangQuery;
 }
예제 #32
0
            public void UpdatesOnlyRemoteAccessPermissions()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = true,
                    RemoteControlPassword = null
                };

                var accessControl = new AccessControl(settings);

                Guid localToken = accessControl.RegisterLocalAccessToken();

                Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid());
                var remotePermissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

                accessControl.SetRemotePassword(localToken, "password");

                Assert.Equal(AccessPermission.Admin, accessControl.ObserveAccessPermission(localToken).FirstAsync().Wait());
                Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest }, remotePermissions);
            }
예제 #33
0
 public BTSImportExcelHandler(GlobalSolusindoDb db, tblM_User user, BTSValidator btsValidator, BTSFactory btsFactory, BTSQuery btsQuery, AccessControl accessControl) : base(db, user)
 {
     this.btsValidator         = btsValidator;
     this.btsFactory           = btsFactory;
     this.btsQuery             = btsQuery;
     this.btsEntryDataProvider = new BTSEntryDataProvider(db, user, accessControl, btsQuery);
     //((IObjectContextAdapter)Db).ObjectContext.CommandTimeout = 300; //set time out
     //db.Database.CommandTimeout = 300;
 }
 public MembershipParameters()
 {
     CustNameAndAddress = new NameAndAddress();
     AccessControl      = new AccessControl();
 }
 public CabangCreateHandler(GlobalSolusindoDb db, tblM_User user, CabangValidator cabangValidator, CabangFactory cabangFactory, CabangQuery cabangQuery, AccessControl accessControl) : base(db, user)
 {
     this.cabangValidator         = cabangValidator;
     this.cabangFactory           = cabangFactory;
     this.cabangQuery             = cabangQuery;
     this.cabangEntryDataProvider = new CabangEntryDataProvider(db, user, accessControl, cabangQuery);
 }
 public IzinCutiEntryDataProvider(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl, IzinCutiQuery izinCutiQuery) : base(db, user)
 {
     this.accessControl = accessControl;
     this.izinCutiQuery = izinCutiQuery;
 }
예제 #37
0
            public void ThrowsInvalidOperationExceptionIfVotingIsDisabled()
            {
                var settings = new CoreSettings { EnableVotingSystem = false };

                var accessControl = new AccessControl(settings);
                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<InvalidOperationException>(() => accessControl.RegisterVote(token, SetupVotedEntry()));
            }
예제 #38
0
 public CheckInUpdateHandler(GlobalSolusindoDb db, tblM_User user, CheckInValidator checkInValidator, CheckInFactory checkInFactory, CheckInQuery checkInQuery, AccessControl accessControl) : base(db, user)
 {
     this.checkInValidator         = checkInValidator;
     this.checkInFactory           = checkInFactory;
     this.checkInQuery             = checkInQuery;
     this.checkInEntryDataProvider = new CheckInEntryDataProvider(db, user, accessControl, checkInQuery);
 }
예제 #39
0
            public void ValidatesPassword()
            {
                var settings = new CoreSettings();

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, ""));
                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, " "));
                Assert.Throws<ArgumentNullException>(() => accessControl.SetLocalPassword(token, null));
            }
예제 #40
0
 public DeliveryCacheStorageService(BcatServer server, ulong applicationId, AccessControl accessControl)
 {
     Server        = server;
     ApplicationId = applicationId;
     Access        = accessControl;
 }
예제 #41
0
            public void WithRemoteTokenThrowsArgumentException()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                Assert.Throws<ArgumentException>(() => accessControl.SetLocalPassword(token, "password123"));
            }
예제 #42
0
        private void InitTaskList()
        {
            //获取权限
            taskList.Add("获取用户权限", () =>
            {
                try
                {
                    if (ExtendApplicationContext.Current.LoginUser.MDSD_APPLICATION != null && ExtendApplicationContext.Current.LoginUser.MDSD_APPLICATION.MENU_LIST.Count > 0)
                    {
                        foreach (MDSD.Permission.Domain.MDSD_MENU menuList in ExtendApplicationContext.Current.LoginUser.MDSD_APPLICATION.MENU_LIST)
                        {
                            if (menuList.SUB_MENU_LIST.Count > 0)
                            {
                                foreach (MDSD.Permission.Domain.MDSD_MENU menu in menuList.SUB_MENU_LIST)
                                {
                                    AccessControl.AddPermission(menu.MENU_KEY, menuList.MENU_KEY);
                                }
                            }
                        }
                    }
                    //ExtendApplicationContext.Current.PermissionsList =
                    //    AccountService.GetPermission(
                    //        ExtendApplicationContext.Current.ApplicationID,
                    //        ExtendApplicationContext.Current.LoginUser.LOGIN_NAME);
                    return(true);
                }
                catch (Exception ex)
                {
                    Logger.Error(errorTitle, ex);
                    return(false);
                }
            });
            //#region 所有字典,聚合一起请求获取
            //taskList.Add("所有字典,聚合一起请求获取", () =>
            //{
            //    try
            //    {
            //        dynamic data = CommDictService
            //            .GetAllDictList(ExtendApplicationContext.Current.LoginUser.LOGIN_NAME);
            //        if (data.EventDict != null) //录入字典表
            //        {
            //            string value = data.EventDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.EventDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_EVENT_DICT>>(value);
            //        }
            //        if (data.EventDictExt != null) //麻醉事件字典扩展表
            //        {
            //            string value = data.EventDictExt.ToString();
            //            ExtendApplicationContext.Current.CommDict.EventDictExt
            //                = JsonConvert.DeserializeObject<List<Domain.MED_EVENT_DICT_EXT>>(value);
            //        }
            //        if (data.UnitDictExt != null) //属性单位字典表
            //        {
            //            string value = data.UnitDictExt.ToString();
            //            ExtendApplicationContext.Current.CommDict.UnitDictExt
            //                = JsonConvert.DeserializeObject<List<Domain.MED_UNIT_DICT>>(value);
            //        }
            //        if (data.AdministrationDictExt != null) //给药途径字典表
            //        {
            //            string value = data.AdministrationDictExt.ToString();
            //            ExtendApplicationContext.Current.CommDict.AdministrationDictExt
            //                = JsonConvert.DeserializeObject<List<Domain.MED_ADMINISTRATION_DICT>>(value);
            //        }
            //        if (data.EventSortDict != null) //麻醉事件排序字典表
            //        {
            //            string value = data.EventSortDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.EventSortDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_EVENT_SORT>>(value);
            //        }
            //        if (data.HisUsersDict != null) //用户字典表
            //        {
            //            string value = data.HisUsersDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.HisUsersDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_HIS_USERS>>(value);
            //        }
            //        if (data.DeptDict != null) //科室字典表
            //        {
            //            string value = data.DeptDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.DeptDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_DEPT_DICT>>(value);
            //        }
            //        if (data.MonitorFuntionDict != null) //检测项目字典表
            //        {
            //            string value = data.MonitorFuntionDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.MonitorFuntionDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_MONITOR_FUNCTION_CODE>>(value);
            //        }
            //        if (data.OperationRoomDict != null) //手术室字典表
            //        {
            //            string value = data.OperationRoomDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.OperationRoomDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_OPERATING_ROOM>>(value);
            //        }
            //        if (data.AnesInputDictDict != null) //通用项目字典表
            //        {
            //            string value = data.AnesInputDictDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.AnesInputDictDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_ANESTHESIA_INPUT_DICT>>(value);
            //        }
            //        if (data.BloodGasDict != null) //血气字典表
            //        {
            //            string value = data.BloodGasDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.BloodGasDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_BLOOD_GAS_DICT>>(value);
            //        }
            //        if (data.WardDict != null) //病区字典表
            //        {
            //            string value = data.WardDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.WardDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_WARD_DICT>>(value);
            //        }
            //        if (data.AnesMethodDict != null) //麻醉方法字典表
            //        {
            //            string value = data.AnesMethodDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.AnesMethodDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_ANESTHESIA_DICT>>(value);
            //        }
            //        if (data.MonitorDict != null) //麻醉方法字典表
            //        {
            //            string value = data.MonitorDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.MonitorDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_MONITOR_DICT>>(value);
            //        }
            //        if (data.HosotalConfigDict != null) //获取医院抬头
            //        {
            //            string value = data.HosotalConfigDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.HosotalConfigDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_HOSPITAL_CONFIG>>(value);
            //        }
            //        if (data.ConfigDict != null)
            //        {
            //            string value = data.ConfigDict.ToString();
            //            ExtendApplicationContext.Current.CommDict.ConfigDict
            //                = JsonConvert.DeserializeObject<List<Domain.MED_CONFIG>>(value);
            //        }
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 所有字典,聚合一起请求获取

            ///*
            //#region 录入字典表
            //taskList.Add("麻醉事件字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.EventDict
            //            = CommDictService.GetEventDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 麻醉事件字典扩展表
            //taskList.Add("麻醉事件字典扩展表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.EventDictExt
            //            = CommDictService.GetAnesEventDictExt();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 属性单位字典表
            //taskList.Add("属性单位字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.UnitDictExt
            //            = CommDictService.GetUnitDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 给药途径字典表
            //taskList.Add("给药途径字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.AdministrationDictExt
            //            = CommDictService.GetAdminstrationDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 麻醉事件排序字典表
            //taskList.Add("麻醉事件排序字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.EventSortDict
            //            = CommDictService.GetEventSortList(ExtendApplicationContext.Current.LoginUser.LOGIN_NAME);
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 用户字典表
            //taskList.Add("用户字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.HisUsersDict
            //            = CommDictService.GetHisUsersList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 科室字典表
            //taskList.Add("科室字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.DeptDict
            //            = CommDictService.GetDeptDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 检测项目字典表
            //taskList.Add("检测项目字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.MonitorFuntionDict
            //            = CommDictService.GetMonitorFuctionCodeList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 手术室字典表
            //taskList.Add("手术室字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.OperationRoomDict
            //            = CommDictService.GetOperatingRoomList(0);
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //*/
            //#endregion
            ///* 数据较多 */
            //#region 手术名称字典表
            //taskList.Add("手术名称字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.OperationNameDict
            //            = CommDictService.GetOperNameDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            ///* 数据较多 */
            //#region 诊断字典表
            //taskList.Add("诊断字典表", () =>
            //{
            //    try
            //    {
            //        //ExtendApplicationContext.Current.CommDict.DiagnosisDict
            //        //    = CommDictService.GetDiagDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 所有字典,聚合一起请求获取
            ///*
            //#region 通用项目字典表
            //taskList.Add("通用项目字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.AnesInputDictDict
            //            = CommDictService.GetAnesInputDictList(null);
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 血气字典表
            //taskList.Add("血气字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.BloodGasDict
            //            = CommDictService.GetBloodGasDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 病区字典表
            //taskList.Add("病区字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.WardDict
            //            = CommDictService.GetWardDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 麻醉方法字典表
            //taskList.Add("麻醉方法字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.AnesMethodDict
            //            = CommDictService.GetAnesMethodDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //#region 监护仪字典表
            //taskList.Add("监护仪字典表", () =>
            //{
            //    try
            //    {
            //        ExtendApplicationContext.Current.CommDict.MonitorDict
            //            = CommDictService.GetMonitorDictList();
            //        return true;
            //    }
            //    catch (Exception ex)
            //    {
            //        LogHelper.WriteErrLog(errorTitle, ex);
            //        return false;
            //    }
            //});
            //#endregion
            //*/
            //#endregion
            #region 换成字典表DataTable
            taskList.Add("换成字典表DataTable", () =>
            {
                try
                {
                    Type type                = ExtendApplicationContext.Current.CommDict.GetType();
                    Type elemType            = null;
                    PropertyInfo[] propInfos = type.GetProperties();
                    foreach (var prop in propInfos)
                    {
                        var value = prop.GetValue(ExtendApplicationContext.Current.CommDict, null);
                        if (value != null &&
                            (type = value.GetType()) != null &&
                            typeof(IList).IsAssignableFrom(type) &&
                            (elemType = type.GetGenericArguments()[0]) != null &&
                            elemType.IsSubclassOf(typeof(BaseModel)))
                        {
                            var list     = value as IList;
                            DataTable dt = ModelHelper.ConvertListToDataTable(list);
                            ExtendAppContext.Current.CodeTables.Add(elemType.Name, dt);
                        }
                    }

                    return(true);
                }
                catch (Exception ex)
                {
                    Logger.Error(errorTitle, ex);
                    return(false);
                }
            });
            #endregion
        }
예제 #43
0
            public void ThrowsArgumentExceptionOnBogusAccessToken()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();
                accessControl.SetLocalPassword(token, "password123");

                Assert.Throws<ArgumentException>(() => accessControl.UpgradeLocalAccess(new Guid(), "password123"));
            }
예제 #44
0
 public BTSTechnologyUpdateHandler(GlobalSolusindoDb db, tblM_User user, BTSTechnologyValidator btsTechnologyValidator, BTSTechnologyFactory btsTechnologyFactory, BTSTechnologyQuery btsTechnologyQuery, AccessControl accessControl) : base(db, user)
 {
     this.btsTechnologyValidator         = btsTechnologyValidator;
     this.btsTechnologyFactory           = btsTechnologyFactory;
     this.btsTechnologyQuery             = btsTechnologyQuery;
     this.btsTechnologyEntryDataProvider = new BTSTechnologyEntryDataProvider(db, user, accessControl, btsTechnologyQuery);
 }
예제 #45
0
            public void UpgradesToAdmin()
            {
                var settings = new CoreSettings();
                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                accessControl.SetLocalPassword(token, "password123");
                accessControl.UpgradeLocalAccess(token, "password123");

                accessControl.VerifyAccess(token);
            }
예제 #46
0
        public async Task <IActionResult> UpdateTenant([FromBody] AccessControl accessControl)
        {
            var result = await _accessControlStore.UpdateAccessControlAsync(accessControl);

            return(Ok(result));
        }
예제 #47
0
            public void UpgradesToAdmin()
            {
                var settings = new CoreSettings
                {
                    LockRemoteControl = true,
                    RemoteControlPassword = "******"
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterRemoteAccessToken(new Guid());

                accessControl.UpgradeRemoteAccess(token, "password123");

                accessControl.VerifyAccess(token);
            }
예제 #48
0
 public DeliveryAreaUpdateHandler(GlobalSolusindoDb db, tblM_User user, DeliveryAreaValidator deliveryAreaValidator, DeliveryAreaFactory deliveryAreaFactory, DeliveryAreaQuery deliveryAreaQuery, AccessControl accessControl) : base(db, user)
 {
     this.deliveryAreaValidator         = deliveryAreaValidator;
     this.deliveryAreaFactory           = deliveryAreaFactory;
     this.deliveryAreaQuery             = deliveryAreaQuery;
     this.deliveryAreaEntryDataProvider = new DeliveryAreaEntryDataProvider(db, user, accessControl, deliveryAreaQuery);
 }
예제 #49
0
            public void WithLocalAccessTokenThrowsArgumentException()
            {
                var settings = new CoreSettings
                {
                    RemoteControlPassword = "******"
                };

                var accessControl = new AccessControl(settings);

                Guid token = accessControl.RegisterLocalAccessToken();

                Assert.Throws<ArgumentException>(() => accessControl.UpgradeRemoteAccess(token, "password123"));
            }
예제 #50
0
        public void UpdatesRemoteAccessWhenLockRemoteSettingChanges()
        {
            var settings = new CoreSettings
            {
                LockRemoteControl = false
            };

            var accessControl = new AccessControl(settings);

            Guid remoteToken = accessControl.RegisterRemoteAccessToken(new Guid());
            Guid adminToken = accessControl.RegisterLocalAccessToken();

            var permissions = accessControl.ObserveAccessPermission(remoteToken).CreateCollection();

            settings.LockRemoteControl = true;
            accessControl.SetRemotePassword(adminToken, "password");

            settings.LockRemoteControl = false;
            settings.LockRemoteControl = true;

            Assert.Equal(new[] { AccessPermission.Admin, AccessPermission.Guest, AccessPermission.Admin, AccessPermission.Guest }, permissions);
        }
예제 #51
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();

        if (!ac.getSectionAccess("Coupons"))
        {
            Response.Redirect("~/Error.aspx?Code=NoAccess");
        }

        DataTable     dt         = new DataTable();
        DataTable     dtComments = new DataTable();
        DataSet       ds         = new DataSet();
        SqlConnection sqlConn    = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_couponInfoShow", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@CouponId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["CouponId"]);
        sda.Fill(ds);
        dt         = ds.Tables[0];
        dtComments = ds.Tables[1];

        if (dt.Rows.Count == 0) //news doesn't exist
        {
            Response.Redirect("~/Error.aspx?Code=NoCoupon");
        }
        else //news exists
        {
            //Offer
            HiddenFieldCouponId.Value = Request.QueryString["CouponId"];
            Page.Title = "Salestan : " + dt.Rows[0]["Title"].ToString();
            ImageMainPhoto.ImageUrl  = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + ".jpg";
            LabelTitle.Text          = dt.Rows[0]["Title"].ToString();
            LiteralHighlights.Text   = "<div class='OffersDescriptions'>" + dt.Rows[0]["Highlights"].ToString() + "</div>";
            LiteralDetails.Text      = "<div class='OffersDescriptions'>" + dt.Rows[0]["Details"].ToString() + "</div>";
            LiteralDescriptions.Text = "<div class='OffersDescriptions'>" + dt.Rows[0]["Descriptions"].ToString() + "</div>";
            LabelStartCoupon.Text    = dt.Rows[0]["StartCoupon"].ToString();
            LabelEndCoupon.Text      = dt.Rows[0]["EndCoupon"].ToString();


            //Remained Time countdown
            DateTime offerEndDate = Convert.ToDateTime(dt.Rows[0]["EndDate"].ToString());
            string   month        = " ";
            switch (offerEndDate.Month.ToString())
            {
            case "1":
            {
                month = "january";
                break;
            }

            case "2":
            {
                month = "february";
                break;
            }

            case "3":
            {
                month = "march";
                break;
            }

            case "4":
            {
                month = "april";
                break;
            }

            case "5":
            {
                month = "may";
                break;
            }

            case "6":
            {
                month = "june";
                break;
            }

            case "7":
            {
                month = "july";
                break;
            }

            case "8":
            {
                month = "august";
                break;
            }

            case "9":
            {
                month = "september";
                break;
            }

            case "10":
            {
                month = "october";
                break;
            }

            case "11":
            {
                month = "november";
                break;
            }

            case "12":
            {
                month = "december";
                break;
            }
            }
            HiddenFieldEndDate.Value = month + " " + offerEndDate.Day + ", " + offerEndDate.Year + " " + offerEndDate.Hour + ":" + offerEndDate.Minute;


            //Links
            if (dt.Rows[0]["Link1Type"].ToString() != "0")
            {
                HyperLinkLink1.Visible     = true;
                HyperLinkLink1.ImageUrl    = "~/images/offers/LinkTypes/LinkType" + dt.Rows[0]["Link1Type"].ToString() + ".png";
                HyperLinkLink1.NavigateUrl = dt.Rows[0]["Link1Url"].ToString();
            }
            if (dt.Rows[0]["Link2Type"].ToString() != "0")
            {
                HyperLinkLink2.Visible     = true;
                HyperLinkLink2.ImageUrl    = "~/images/offers/LinkTypes/LinkType" + dt.Rows[0]["Link2Type"].ToString() + ".png";
                HyperLinkLink2.NavigateUrl = dt.Rows[0]["Link2Url"].ToString();
            }
            if (dt.Rows[0]["Link3Url"].ToString() != "0")
            {
                HyperLinkLink3.Visible     = true;
                HyperLinkLink3.ImageUrl    = dt.Rows[0]["Link3Image"].ToString();;
                HyperLinkLink3.NavigateUrl = dt.Rows[0]["Link3Url"].ToString();
            }

            //Comapny
            LabelCompanyName.Text        = dt.Rows[0]["Name"].ToString();
            LabelCompanyAbout.Text       = dt.Rows[0]["About"].ToString();
            LabelTel.Text                = dt.Rows[0]["Tel"].ToString();
            LabelMobile.Text             = dt.Rows[0]["Mobile"].ToString();
            LabelEmail.Text              = dt.Rows[0]["Email"].ToString();
            LabelFax.Text                = dt.Rows[0]["Fax"].ToString();
            HyperLinkWebsite.Text        = dt.Rows[0]["Website"].ToString();
            HyperLinkWebsite.NavigateUrl = dt.Rows[0]["Website"].ToString();
            LabelAddress.Text            = dt.Rows[0]["Address"].ToString();
            HiddenFieldGoogleId.Value    = dt.Rows[0]["GoogleMap"].ToString();
            ImageCompany.ImageUrl        = "~/Files/companies/" + dt.Rows[0]["CompanyId"].ToString() + ".jpg";
            LabelCouponsCount.Text       = dt.Rows[0]["CouponsCount"].ToString();
        }

        //Comment
        StringBuilder sb3 = new StringBuilder();

        if (dtComments.Rows.Count != 0)
        {
            for (int i = 0; i < dtComments.Rows.Count; i++)
            {
                sb3.AppendLine("<br/>");
                sb3.AppendLine("<div class='FormLabel' style='direction:rtl;'>");
                sb3.AppendLine(dtComments.Rows[i]["Comment"].ToString());
                if (dtComments.Rows[i]["Answer"].ToString() != "")
                {
                    sb3.AppendLine("<br/><br/>");
                    sb3.AppendLine("<img alt='' height='20' src='images/logosmall.png' width='60' /><br/>");
                    sb3.AppendLine("<strong>" + dtComments.Rows[i]["Answer"].ToString() + "</strong>");
                }
                sb3.AppendLine("</div>");
                sb3.AppendLine("<br/>");
                sb3.AppendLine("<hr style='color:#CAE1E6' />");
            }
            LiteralComment.Text = sb3.ToString();
        }
        sda.Dispose();
        sqlConn.Close();
    }
예제 #52
0
        public void Setup()
        {
            _directories = new List <DataLakeDirectory>
            {
                new DataLakeDirectory
                {
                    Path    = "raw/directory",
                    Upn     = true,
                    Recurse = true,
                    Acls    = new List <Acl>
                    {
                        new Acl
                        {
                            Read           = true,
                            Write          = true,
                            Execute        = true,
                            DefaultRead    = true,
                            DefaultWrite   = true,
                            DefaultExecute = true,
                            Identity       = "ea6be951-d694-4b49-bd5c-fef06e7b9a59",
                            ObjectType     = ObjectType.User
                        },
                        new Acl
                        {
                            Read           = true,
                            Write          = true,
                            Execute        = true,
                            DefaultRead    = true,
                            DefaultWrite   = true,
                            DefaultExecute = true,
                            Identity       = "c20047f4-79e8-4446-b441-b1ea03a8e17d",
                            ObjectType     = ObjectType.User
                        }
                    }
                },
                new DataLakeDirectory
                {
                    Path    = "trusted/directory",
                    Upn     = true,
                    Recurse = true,
                    Acls    = new List <Acl>
                    {
                        new Acl
                        {
                            Read           = true,
                            Write          = true,
                            Execute        = true,
                            DefaultRead    = true,
                            DefaultWrite   = true,
                            DefaultExecute = true,
                            Identity       = "c20047f4-79e8-4446-b441-b1ea03a8e17d",
                            ObjectType     = ObjectType.User
                        }
                    }
                }
            };

            var rawAccessControl = new AccessControl("$superuser", "$superuser", "rwxrwx---+",
                                                     "user::rwx,user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,group::r-x,mask::rwx,other::---,default:user::rwx,default:user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,default:user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,default:group::r-x,default:mask::rwx,default:other::---");

            var trustedAccessControl = new AccessControl("$superuser", "$superuser", "rwxrwx---+",
                                                         "user::rwx,user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,group::r-x,mask::rwx,other::---,default:user::rwx,default:user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,default:group::r-x,default:mask::rwx,default:other::---");

            var file1AccessControl = new AccessControl("c20047f4-79e8-4446-b441-b1ea03a8e17d", "$superuser",
                                                       "rw-r-----+",
                                                       "user::rw-,user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,group::r-x,mask::r--,other::---");

            var file2AccessControl = new AccessControl("c20047f4-79e8-4446-b441-b1ea03a8e17d", "$superuser",
                                                       "rw-r-----+",
                                                       "user::rw-,user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,group::r-x,mask::r--,other::---");

            var subDirectoryAccessControl = new AccessControl("$superuser", "$superuser", "rwxrwx---+",
                                                              "user::rwx,user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,group::r-x,mask::rwx,other::---,default:user::rwx,default:user:c20047f4-79e8-4446-b441-b1ea03a8e17d:rwx,default:user:ea6be951-d694-4b49-bd5c-fef06e7b9a59:rwx,default:group::r-x,default:mask::rwx,default:other::---");

            var newAccessControl = new AccessControl("$superuser", "$superuser", "rwxr-x---", "user::rwx,group::r-x,other::---");

            _azureDataLakeStorage = new Mock <IAzureDataLakeStorageWrapper>();

            _azureDataLakeStorage.Setup(x => x.ExistsAsync("raw/directory", It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            _azureDataLakeStorage.Setup(x => x.ExistsAsync("trusted/directory", It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(true));

            _azureDataLakeStorage.Setup(x => x.ListFilesystemsAsync(It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(
                         (IReadOnlyCollection <Filesystem>) new List <Filesystem> {
                new Filesystem {
                    Name = "new"
                }
            })
                     );

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("raw/directory", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(rawAccessControl));

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("trusted/directory", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(trustedAccessControl));

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("trusted/directory/file1.parquet", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(file1AccessControl));

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("trusted/directory/file2.parquet", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(file2AccessControl));

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("trusted/directory/subdirectory", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(subDirectoryAccessControl));

            _azureDataLakeStorage.Setup(x => x.GetAccessControlAsync("new", true, It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult(newAccessControl));

            _azureDataLakeStorage
            .Setup(x => x.SetAccessControlAsync(It.IsAny <string>(), It.IsAny <AccessControl>(), It.IsAny <CancellationToken>()))
            .Returns(Task.CompletedTask);

            _azureDataLakeStorage
            .Setup(x => x.ListAsync(It.Is <ListOptions>(y => y.FolderPath == "trusted/directory"),
                                    It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult((IReadOnlyCollection <Blob>) new List <Blob>
            {
                new Blob("trusted/directory/file1.parquet"),
                new Blob("trusted/directory/file2.parquet"),
                new Blob("trusted/directory/subdirectory", BlobItemKind.Folder)
            }));

            _azureDataLakeStorage
            .Setup(x => x.ListAsync(It.Is <ListOptions>(y => y.FolderPath != "trusted/directory"),
                                    It.IsAny <CancellationToken>()))
            .Returns(Task.FromResult((IReadOnlyCollection <Blob>) new List <Blob>()));

            _logger = new Mock <ILogger>();
            _sut    = new ApplyPermissions(_azureDataLakeStorage.Object, _logger.Object);
        }
예제 #53
0
 public KategoriJabatanEntryControlBuilder(GlobalSolusindoDb db, tblM_User user, AccessControl accessControl) : base(db, user)
 {
     this.accessControl = accessControl;
 }
예제 #54
0
 public SaveButtonBuilder(GlobalSolusindoDb db, tblM_User user, EntryFormState formState, AccessControl accessControl) : base(db, user)
 {
     this.accessControl = accessControl;
     this.formState     = formState;
 }
예제 #55
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AccessControl ac = new AccessControl();
        if (!ac.getSectionAccess("Purchase"))
        {
            PanelAll.Visible = false;
            PanelNoAccess.Visible = true;
            Response.End();
        }

        if (!IsPostBack)
        {
            if (Session["UserId"] != null)
            {
                DataTable dt = new DataTable();
                DataSet ds = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_buyActionOfferInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["ItemId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0) //offer doesn't exist
                {
                    PanelError.Visible = true;
                    PanelProcess.Visible = false;
                    PanelSuccessful.Visible = false;
                    ImageError.ImageUrl = "~/images/messages/notfound.png";
                }
                else //offer exists
                {
                    DateTime Deadline = Convert.ToDateTime(dt.Rows[0]["EndDate"].ToString());
                    if (DateTime.Now <= Deadline)
                    {
                        PanelError.Visible = false;
                        PanelProcess.Visible = true;
                        PanelSuccessful.Visible = false;

                        DataTable dtUser = new DataTable();
                        DataSet ds2 = new DataSet();

                        SqlDataAdapter sda2 = new SqlDataAdapter("sp_buyActionUserCreditInfo", sqlConn);
                        sda2.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda2.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Session["UserId"]);
                        sda2.Fill(ds2);
                        dtUser = ds2.Tables[0];

                        HyperLinkTitle.Text = dt.Rows[0]["Title"].ToString();
                        HyperLinkTitle.NavigateUrl = "~/ShowOffer.aspx?OfferId=" + Request.QueryString["ItemId"];
                        ImagePhoto.ImageUrl = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + "t.jpg";
                        //LabelUser.Text = dtUser.Rows[0]["FullName"].ToString();
                        LabelNormalPrice.Text = dt.Rows[0]["PriceNormal"].ToString();
                        LabelSinglePrice.Text = dt.Rows[0]["PriceOffer"].ToString();
                        LabelPostPrice.Text = dt.Rows[0]["PostPrice"].ToString();
                        LabelAllPrice.Text = dt.Rows[0]["PriceOffer"].ToString();
                        LabelGiftPrice.Text = dt.Rows[0]["PriceGift"].ToString();
                        LabelAllGift.Text = dt.Rows[0]["PriceGift"].ToString();
                        LabelUserGift.Text = dtUser.Rows[0]["GiftCredit"].ToString();
                        LabelUserCredit.Text = dtUser.Rows[0]["Credit"].ToString();

                        int MinUser = Convert.ToInt32(dt.Rows[0]["MinUser"].ToString()) - 1;
                        int MaxUser = Convert.ToInt32(dt.Rows[0]["MaxUser"].ToString());

                        for (int i = MinUser; i < MaxUser; i++)
                        {
                            DropDownListQuantity.Items.Add(Convert.ToString(i + 1));
                        }

                        if (Convert.ToInt32(LabelAllGift.Text) > Convert.ToInt32(LabelUserGift.Text))
                        {
                            LabelPayment.Text = (Convert.ToInt32(LabelAllPrice.Text) - Convert.ToInt32(LabelUserGift.Text) + Convert.ToInt32(LabelPostPrice.Text)).ToString();
                            LabelGiftSpend.Text = LabelUserGift.Text;
                        }
                        else
                        {
                            LabelPayment.Text = (Convert.ToInt32(LabelAllPrice.Text) - Convert.ToInt32(LabelAllGift.Text) + Convert.ToInt32(LabelPostPrice.Text)).ToString();
                            LabelGiftSpend.Text = LabelAllGift.Text;
                        }

                        sda2.Dispose();

                    }
                    else if (DateTime.Now > Deadline)
                    {
                        PanelError.Visible = true;
                        PanelProcess.Visible = false;
                        PanelSuccessful.Visible = false;
                        ImageError.ImageUrl = "~/images/messages/expired.png";
                    }
                }

                sda.Dispose();
                sqlConn.Close();

            }
            else
            {
                PanelError.Visible = true;
                PanelProcess.Visible = false;
                PanelSuccessful.Visible = false;
                ImageError.ImageUrl = "~/images/messages/loginfirst.png";
            }
        }
    }
예제 #56
0
 public BTSCreateHandler(GlobalSolusindoDb db, tblM_User user, BTSValidator btsValidator, BTSFactory btsFactory, BTSQuery btsQuery, AccessControl accessControl) : base(db, user)
 {
     this.btsValidator         = btsValidator;
     this.btsFactory           = btsFactory;
     this.btsQuery             = btsQuery;
     this.btsEntryDataProvider = new BTSEntryDataProvider(db, user, accessControl, btsQuery);
 }
예제 #57
0
        public QueryAlertLogResult QueryAlertLog(AccessControl AccessInformation, AlertLogQueryCondition QueryCondition)
        {
            QueryAlertLogResult queryAlertLogResult = new QueryAlertLogResult();
            //dowhat= QueryAlertLog,
            //begin_year= XXX,
            //begin_month= XXX,
            //begin_day= XXX,
            //begin_hour= XXX,
            //begin_minute= XXX,
            //begin_second= XXX,
            //end_year= XXX,
            //end_month= XXX,
            //end_day= XXX,
            //end_hour= XXX,
            //end_minute= XXX,
            //end_second= XXX,
            //alertName= XXX,
            //alertReceive= XXX,
            //alertType= XXX;
            ////alertName��alertReceive��alertType �� and ��ϵ�����Ϊ����Ϊȫ����

            SortedDictionary<string, string> paras = new SortedDictionary<string,string>();

            paras.Add("dowhat","QueryAlertLog");
            paras.Add("begin_year",QueryCondition.StartTime.Year.ToString());
            paras.Add("begin_month",QueryCondition.StartTime.Month.ToString());
            paras.Add("begin_day",QueryCondition.StartTime.Day.ToString());
            paras.Add("begin_hour",QueryCondition.StartTime.Hour.ToString());
            paras.Add("begin_minute",QueryCondition.StartTime.Minute.ToString());
            paras.Add("begin_second",QueryCondition.StartTime.Second.ToString());
            paras.Add("end_year",QueryCondition.EndTime.Year.ToString());
            paras.Add("end_month",QueryCondition.EndTime.Month.ToString());
            paras.Add("end_day",QueryCondition.EndTime.Day.ToString());
            paras.Add("end_hour",QueryCondition.EndTime.Hour.ToString());
            paras.Add("end_minute",QueryCondition.EndTime.Minute.ToString());
            paras.Add("end_second",QueryCondition.EndTime.Second.ToString());

            if(QueryCondition.LimitName)
            {
                paras.Add("alertName", QueryCondition.AlertName);
            }

            if(QueryCondition.LimitReceiver)
            {
                paras.Add("alertReceive", QueryCondition.AlertReceiver);
            }

            if(QueryCondition.LimitType)
            {
                paras.Add("alertType", QueryCondition.AlertType.ToString("D"));
            }
            if (QueryCondition.LimitIndex)
            {
                paras.Add("alertIndex", QueryCondition.AlertIndex);
            }

            anyType2anyTypeMapEntry[] requestData = new anyType2anyTypeMapEntry[paras.Count];

            int i = 0;
            foreach(string key in paras.Keys)
            {
                anyType2anyTypeMapEntry node = Helper.XfireCreateKeyValue(key, paras[key]);
                requestData[i++] = node;
            }

            this.service.Url = UserPermissionContext.Instance.Url;
            RetMapInVector result = ServiceClient.GetForestData(requestData);
            //RetMapInVector result = this.service.GetForestData(requestData);
            if (!result.retbool)
            {
                if (logger.IsWarnEnabled)
                {
                    logger.Warn(result.estr);
                }
                return null;
            }

            queryAlertLogResult.ErrorInformation = result.estr;
            queryAlertLogResult.QueryAlertLogOK = result.retbool;

            IList<NameValueCollection> resultData = Helper.XfireConventMapEntryToList(result.vmap);
            AlertLogItem[] responseData = new AlertLogItem[resultData.Count];
            for (int j = 0; j < resultData.Count; j++)
            {
                NameValueCollection record = resultData[j];
                AlertLogItem item = new AlertLogItem();
                item.AlertIndex = record["_AlertIndex"];
                item.AlertName = record["_AlertRuleName"];
                item.EntityName = record["_DeviceName"];
                item.MonitorName = record["_MonitorName"];
                item.AlertReceiver = record["_AlertReceive"];
                item.AlertStatus = (AlertStatus)Enum.Parse(typeof(AlertStatus), record["_AlertStatus"]);
                item.AlertTime = DateTime.Parse(record["_AlertTime"]);
                item.AlertType = (AlertType)Enum.Parse(typeof(AlertType), record["_AlertType"]);

                responseData[j] = item;

            }

            queryAlertLogResult.ResponseData = responseData;

            return queryAlertLogResult;
        }
 public override bool CanInsertRecord()
 {
     return(AccessControl.HasPrivelege(Priveleges.DirectoriesReadWrite));
 }
예제 #59
0
 public AsyncAclOperation(IAsyncDocumentSession session, AccessControl acl)
 {
     _session = session;
     _acl = acl;
 }
예제 #60
0
        public void ShowFormByDocName(object patientId, object visitId, object operId, List <string> item)
        {
            string firstDocName = "";

            bocList.Clear();
            reportNameDic.Clear();
            try
            {
                BaseDoc baseDoc = new BaseDoc();

                foreach (string docName in item)
                {
                    if (!string.IsNullOrEmpty(docName))
                    {
                        if (string.IsNullOrEmpty(firstDocName))
                        {
                            firstDocName = docName;
                        }
                        ApplicationConfiguration.MedicalDocucementElement document = ApplicationConfiguration.GetMedicalDocument(docName);
                        //没有找到退出
                        if (!string.IsNullOrEmpty(document.Caption))
                        {
                            Type t = Type.GetType(document.Type);
                            baseDoc             = Activator.CreateInstance(t) as BaseDoc;
                            baseDoc.BtnClicked += baseDoc_BtnClicked;
                            baseDoc.Caption     = docName;
                            baseDoc.ShowScrollBar();
                            // 设置指定的患者信息
                            if (patientId != null)
                            {
                                object[] objs = new object[3];
                                objs[0] = patientId;
                                objs[1] = visitId;
                                objs[2] = operId;
                                baseDoc.SetDocParameters(objs);
                            }
                            bocList.Add(baseDoc);
                            reportNameDic.Add(docName, ExtendApplicationContext.Current.AppPath + document.Path);
                        }
                    }
                }
                if (reportNameDic.Count > 0)
                {
                    bocList[0].LoadReport(reportNameDic, firstDocName);
                    DialogHostFormPC dialogHostForm = null;
                    dialogHostForm       = new DialogHostFormPC("其他文书", 1200, 900);
                    dialogHostForm.Child = bocList[0];
                    if (AccessControl.CheckModifyRightForOperator(firstDocName))//有Modify权限
                    {
                        bocList[0].SetAllControlEditable(true);
                    }
                    else
                    {
                        bocList[0].SetAllButtonsEnable(false);
                        bocList[0].SetAllControlEditable(false);
                    }
                    if (bocList[0].AllowSingleDocModify())
                    {
                        bocList[0].SetAllControlEditable(true);
                    }
                    dialogHostForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }