gov.va.medora.mdo.dao.vista.VistaUserDao.removeSecurityKey C# (CSharp) Method

removeSecurityKey() public method

public removeSecurityKey ( string duz, AbstractPermission p ) : void
duz string
p AbstractPermission
return void
        public void removeSecurityKey(string duz, AbstractPermission p)
        {
            // No empty args
            if (p == null || String.IsNullOrEmpty(p.Name) || String.IsNullOrEmpty(duz))
            {
                throw new ArgumentNullException("Missing arguments");
            }

            // No bogus security keys
            p.PermissionId = getSecurityKeyIen(p.Name);
            if (!StringUtils.isNumeric(p.PermissionId))
            {
                throw new ArgumentException("No such security key");
            }

            // No bogus users
            if (!isUser(duz))
            {
                throw new ArgumentException("No such user");
            }

            // Make sure user has this key
            if (!hasSecurityKey(duz, p))
            {
                throw new ArgumentException("User does not have key");
            }

            // Do it
            DdrFiler query = buildRemoveSecurityKeyByIenQuery(p.PermissionId, duz);
            string response = query.execute();
            if (response == "")
            {
                throw new UnexpectedDataException("Empty response");
            }
            if (response == "[Data]\r\n")
            {
                return;
            }
            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            if (lines[0] != "[Data]")
            {
                throw new UnexpectedDataException("Unexpected response: " + response);
            }
            if (lines.Length > 1)
            {
                if (lines[1] != "[BEGIN_diERRORS]" || lines.Length < 5)
                {
                    throw new UnexpectedDataException("Unexpected response: " + response);
                }
                throw new ArgumentException(lines[4]);
            }
        }
VistaUserDao