Esempio n. 1
0
        private static MAccessRight retrieveAccessRight(String accessRightMode)
        {
            CTable data = new CTable("");

            data.SetFieldValue("ACCESS_RIGHT_CODE", accessRightMode);

            CTable       acr = OnixWebServiceAPI.SubmitObjectAPI("GetUserContextAccessRight", data);
            MAccessRight m   = null;

            if (acr == null)
            {
                acr = new CTable("");
                m   = new MAccessRight(acr);

                //Next time will call API immediately
                m.LastUpdateDate = DateTime.Now;
                m.ExpireDate     = m.LastUpdateDate;

                //If permission has not been added then allow (I don't want to annoy user if permission is not yet added)
                m.IsEnable = true;
            }
            else
            {
                m = new MAccessRight(acr);
                m.LastUpdateDate = DateTime.Now;
                //Refresh from API in every 5 minutes
                m.ExpireDate = m.LastUpdateDate.AddMinutes(refreshIntervalMinute);
            }

            return(m);
        }
Esempio n. 2
0
        private void updateIsEnable(object obj)
        {
            CheckBox     cbx = (CheckBox)obj;
            MAccessRight ac  = (MAccessRight)cbx.Tag;

            CUtil.EnableForm(false, this);
            CTable dat = OnixWebServiceAPI.SubmitObjectAPI("UpdateGroupAccessRight", ac.GetDbObject());

            CUtil.EnableForm(true, this);
            if (dat != null)
            {
                ac.SetDbObject(dat);
            }
        }
Esempio n. 3
0
        private void cmdSearch_Click(object sender, RoutedEventArgs e)
        {
            permissions.Clear();

            CUtil.EnableForm(false, this);
            ArrayList arr = OnixWebServiceAPI.GetListAPI("GetGroupAccessRightList", "GROUP_ACCESS_RIGHTS", vw.GetDbObject());

            CUtil.EnableForm(true, this);

            foreach (CTable tb in arr)
            {
                MAccessRight ar = new MAccessRight(tb);
                permissions.Add(ar);
            }
        }
Esempio n. 4
0
        private static MAccessRight getAccessRight(String accessRightMode)
        {
            MAccessRight acr = (MAccessRight)accessRights[accessRightMode];

            if (acr == null)
            {
                acr = retrieveAccessRight(accessRightMode);
            }
            else
            {
                if (acr.ExpireDate < DateTime.Now)
                {
                    //Expire
                    acr = retrieveAccessRight(accessRightMode);
                }
            }

            accessRights[accessRightMode] = acr;

            return(acr);
        }
Esempio n. 5
0
        protected override MBaseModel createObject()
        {
            MAccessRight mv = new MAccessRight(new CTable(""));

            return(mv);
        }
Esempio n. 6
0
        public static Boolean VerifyAccessRight(String accessRightMode)
        {
            MAccessRight acr = getAccessRight(accessRightMode);

            return(acr.IsEnable);
        }