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); }
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); } }
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); } }
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); }
protected override MBaseModel createObject() { MAccessRight mv = new MAccessRight(new CTable("")); return(mv); }
public static Boolean VerifyAccessRight(String accessRightMode) { MAccessRight acr = getAccessRight(accessRightMode); return(acr.IsEnable); }