/// <summary> /// Method check does current account have access to requested page. /// </summary> private static void CheckByLevelRight(EAccountFunctionLevelRight currentLevelRights) { // Check does user have access to pages if (!AccountFunctionLevelRights.Contains(currentLevelRights)) { // Throw exception is user doesn't have rights to access. throw new NotImplementedException(); } }
/// <summary> /// Method check can the requested page be displayed to user. /// If user doesn't have rights to see the requested page it redirects to page 403. /// </summary> public static void CheckPriviligesForThisPage(EAccountFunctionLevelRight currentLevelRights) { try { CheckByLevelRight(currentLevelRights); } catch (Exception) { RedirectToDontHaveAccess(); } }
protected static FR_L5AWSSC_CUPfSCBO_1414 Execute(DbConnection Connection, DbTransaction Transaction, P_L5AWSSC_CUPfSCBO_1414 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5AWSSC_CUPfSCBO_1414(); returnValue.Result = new L5AWSSC_CUPfSCBO_1414(); // Get shopping cart var shoppingCart = new CL1_ORD_PRC.ORM_ORD_PRC_ShoppingCart(); shoppingCart.Load(Connection, Transaction, Parameter.ORD_PRC_ShoppingCartID); // Check does current user has a privilege to order ABDA articles var flrParam = new CL2_FunctionLevelRight.Complex.Retrieval.P_L2FLR_GFLRfABoIoG_1554(); flrParam.AccountFunctionLevelRightGroup = new string[1] { DLCore_DBCommons.Utils.EnumUtils.GetEnumDescription(EAccountFunctionLevelRightGroup.APOWebShop) }; var levels = CL2_FunctionLevelRight.Complex.Retrieval.cls_Get_FunctionalLevelRight_for_Account_Based_on_Individuals_or_Groups.Invoke(Connection, Transaction, flrParam, securityTicket); EAccountFunctionLevelRight maxLevel = EAccountFunctionLevelRight.APOWebShopLevel1; foreach (var str in levels.Result) { EAccountFunctionLevelRight l = (EAccountFunctionLevelRight)DLCore_DBCommons.Utils.EnumUtils.GetEnumValueByDescription(str.RightLevel, typeof(EAccountFunctionLevelRight)); if ((int)l > (int)maxLevel) { maxLevel = l; } } switch (maxLevel) { case EAccountFunctionLevelRight.APOWebShopLevel1: returnValue.Result.HasPrivileges = false; returnValue.Result.CreateApprovalShoppingCart = true; break; case EAccountFunctionLevelRight.APOWebShopLevel2: returnValue.Result.HasPrivileges = true; returnValue.Result.CreateApprovalShoppingCart = true; break; case EAccountFunctionLevelRight.APOWebShopLevel3: returnValue.Result.HasPrivileges = true; break; } return(returnValue); #endregion UserCode }