Esempio n. 1
0
        private void InitPermisionList()
        {
            accountPermisionList = new List <AccountPermision>();
            AccountPermision ap = new AccountPermision();

            // administrator
            ap.accountType = AccountType.Admin;
            ap.permition   = PermitionItems.CheckingCode | PermitionItems.accountManager | PermitionItems.adjustColloid | PermitionItems.debug |
                             PermitionItems.debugInfo | PermitionItems.fileManager | PermitionItems.newProductBat | PermitionItems.paramSetting |
                             PermitionItems.pressButton | PermitionItems.register | PermitionItems.systemInfo; // All permision
            accountPermisionList.Add(ap);

            // Engineer
            ap             = new AccountPermision();
            ap.accountType = AccountType.Developer;
            ap.permition   = PermitionItems.CheckingCode | PermitionItems.adjustColloid | PermitionItems.debug |
                             PermitionItems.fileManager | PermitionItems.newProductBat | PermitionItems.paramSetting |
                             PermitionItems.register | PermitionItems.systemInfo;
            accountPermisionList.Add(ap);

            // Operator
            ap             = new AccountPermision();
            ap.accountType = AccountType.Operator;
            ap.permition   = PermitionItems.CheckingCode | PermitionItems.adjustColloid | PermitionItems.newProductBat |
                             PermitionItems.register | PermitionItems.systemInfo;
            accountPermisionList.Add(ap);
        }
Esempio n. 2
0
        public void UpdateAccountPermission(AccountPermision permission)
        {
            foreach (AccountPermision ap in accountPermisionList)
            {
                if (ap.accountType == permission.accountType)
                {
                    ap.permition = permission.permition;
                    //accountPermisionList[accountPermisionList.IndexOf(ap)].permition = permission.permition;

                    return;
                }
            }
        }
Esempio n. 3
0
        public AccountPermision GetAccountPermission(AccountType at)
        {
            foreach (AccountPermision ap in accountPermisionList)
            {
                if (ap.accountType == at)
                {
                    return(ap);
                }
            }

            AccountPermision defaultAp = new AccountPermision();

            defaultAp.accountType = AccountType.Operator;
            defaultAp.permition   = PermitionItems.CheckingCode | PermitionItems.adjustColloid | PermitionItems.newProductBat |
                                    PermitionItems.register | PermitionItems.systemInfo;

            return(defaultAp);
        }