Пример #1
0
        public Boolean hasInsertPrivilege(string table)
        {
            Boolean has            = false;
            User    au             = getActualUser();
            string  actualuserName = au.getName();

            if (actualuserName == "admin")
            {
                has = true;
            }
            else
            {
                Profile         actualProfile = actualUser.getProfile();
                TablePermission tp;
                foreach (TablePermission TABPER in actualProfile.getTablePermissions())
                {
                    if (TABPER.getTableName() == table)
                    {
                        tp = TABPER;
                        if (tp.hasPrivilege("INSERT"))
                        {
                            has = true;
                        }
                        ;
                    }
                }
            }
            return(has);
        }
Пример #2
0
        public Boolean hasSelectPrivilege(string table)
        {
            Boolean has            = false;
            User    au             = getActualUser();
            string  actualuserName = au.getName();

            if (actualuserName == "admin")
            {
                has = true;
            }
            else
            {
                Profile actualProfile = actualUser.getProfile();

                TablePermission tp;
                foreach (TablePermission TABPER in actualProfile.getTablePermissions())
                {
                    if (TABPER.getTableName() == table)
                    {
                        tp = TABPER;
                        if (tp.hasPrivilege("SELECT"))
                        {
                            has = true;
                        }
                        ;
                    }
                }
                //TablePermission tp = actualProfile.getTablePermissions().Find(t => t.getTableName() == table);

                //if (tp!=null) {

                //   Console.WriteLine();
                // }

                //if (tp.hasPrivilege()){ has = true; }
                // Privileges p = tp.getPrivileges().Find(pr => pr == Privileges.SELECT);
                //if (p != null) { has = true; }
            }


            return(has);
        }