Пример #1
0
        public void CheckRoleList(string granteeName, OrderedHashSet <string> roleList, Grantee grantor, bool grant)
        {
            Grantee grantee = this.Get(granteeName);

            for (int i = 0; i < roleList.Size(); i++)
            {
                string  name = roleList.Get(i);
                Grantee role = this.GetRole(name);
                if (role == null)
                {
                    throw Error.GetError(0x898, name);
                }
                if (name.Equals("SYS") || name.Equals("PUBLIC"))
                {
                    throw Error.GetError(0xfa2, name);
                }
                if (grant)
                {
                    if (grantee.GetDirectRoles().Contains(role))
                    {
                        throw Error.GetError(0x898, granteeName);
                    }
                }
                else if (!grantee.GetDirectRoles().Contains(role))
                {
                    throw Error.GetError(0x898, name);
                }
                if (!grantor.IsAdmin())
                {
                    throw Error.GetError(0x7d0, grantor.GetNameString());
                }
            }
        }