/// <summary> /// Получить права пользователя на объект интерфейса /// </summary> public MainData.Right GetRight(string itfObjName) { MainData.Right right; if (Role == ServerComm.Roles.Custom) { if (rightList == null || !rightList.TryGetValue(itfObjName, out right)) right = MainData.Right.NoRights; } else { right = new MainData.Right(); right.CtrlRight = Role == ServerComm.Roles.Admin || Role == ServerComm.Roles.Dispatcher; right.ViewRight = right.CtrlRight || Role == ServerComm.Roles.Guest; } return right; }
/// <summary> /// Инициализировать права на представления из набора /// </summary> private void InitViewRightArr(ViewSetRight viewSetRight) { ViewSettings.ViewSet viewSet = viewSetRight.ViewSet; if (viewSet != null && viewSet.Count > 0) { bool viewSetViewRight = viewSetRight.Right.ViewRight; bool viewSetCtrlRight = viewSetRight.Right.CtrlRight; int viewCnt = viewSet.Count; MainData.Right[] viewRightArr = new MainData.Right[viewCnt]; for (int i = 0; i < viewCnt; i++) { MainData.Right right = GetRight(Path.GetFileName(viewSet[i].FileName)); viewRightArr[i].ViewRight = right.ViewRight && viewSetViewRight; viewRightArr[i].CtrlRight = right.CtrlRight && viewSetCtrlRight; } viewSetRight.ViewRightArr = viewRightArr; } }