Verify that the user and staffMember are not mismatched.
        Location can only be specified if user and staffMember are not.
17856
def clean(self):
        '''
        
        '''

        if self.staffMember and self.staffMember.userAccount and \
        self.user and not self.staffMember.userAccount == self.user:
            raise ValidationError(_('Transaction party user does not match staff member user.'))

        if self.location and (self.user or self.staffMember):
            raise ValidationError(_('Transaction party may not be both a Location and a User or StaffMember.'))
4907
boolean isNameUnique(String name, String currentJobName) {
        Item item = getItem(name);

        if(null==item) {
            // the candidate name didn't return any items so the name is unique
            return true;
        }
        else if(item.getName().equals(currentJobName)) {
            // the candidate name returned an item, but the item is the item
            // that the user is configuring so this is ok
            return true;
        }
        else {
            // the candidate name returned an item, so it is not unique
            return false;
        }
    }
36979
private void checkInquireAuthority(DestinationHandler destination,
                                       String destinationName,
                                       String busName,
                                       SecurityContext secContext,
                                       boolean temporary)
                    throws SINotAuthorizedException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "checkInquireAuthority",
                        new Object[] { destination,
                                      destinationName,
                                      busName,
                                      secContext,
                                      Boolean.valueOf(temporary) });

        // Check authority to inquire on the destination

        if (!temporary) // Non-temorary destination access check
        {
            if (!destination.checkDestinationAccess(secContext,
                                                    OperationType.INQUIRE))
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on this destination");

                // Get the username
                String userName = secContext.getUserName(true);

                //Messaging varies dependent on bus versus destination access check
                String nlsMessage;
                if (destinationName != null)
                {
                    // Build the message for the Exception and the Notification
                    nlsMessage =
                                    nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
                                                            new Object[] { destinationName,
                                                                          userName },
                                                            null);

                    // Fire a Notification if Eventing is enabled
                    _accessChecker.
                                    fireDestinationAccessNotAuthorizedEvent(destinationName,
                                                                            userName,
                                                                            OperationType.INQUIRE,
                                                                            nlsMessage);
                }
                else // foreign bus access
                {
                    // Build the message for the Exception and the Notification
                    nlsMessage =
                                    nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_FB_ERROR_CWSIP0315",
                                                            new Object[] { busName,
                                                                          userName },
                                                            null);

                    // Fire a Notification if Eventing is enabled
                    _accessChecker.
                                    fireDestinationAccessNotAuthorizedEvent(busName,
                                                                            userName,
                                                                            OperationType.INQUIRE,
                                                                            nlsMessage);
                }

                // Thrown if user denied access to destination
                throw new SINotAuthorizedException(nlsMessage);
            }
        }
        else // Check authority to inquire on temp topic
        {
            // get the temp prefix from the destination name
            String destinationPrefix = SIMPUtils.parseTempPrefix(destinationName);
            if (!_accessChecker.checkTemporaryDestinationAccess(secContext,
                                                                destinationName, // name of destination
                                                                (destinationPrefix == null) ? "" : destinationPrefix, // sib.security wants empty string if prefix is null
                                                                OperationType.INQUIRE))
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "checkInquireAuthority", "not authorized to inquire on temporary destination");

                // Get the username
                String userName = secContext.getUserName(true);
                // Build the message for the Exception and the Notification
                String nlsMessage =
                                nls.getFormattedMessage("USER_NOT_AUTH_INQUIRE_ERROR_CWSIP0314",
                                                        new Object[] { destinationPrefix,
                                                                      userName },
                                                        null);

                // Fire a Notification if Eventing is enabled
                _accessChecker.
                                fireDestinationAccessNotAuthorizedEvent(destinationPrefix,
                                                                        userName,
                                                                        OperationType.INQUIRE,
                                                                        nlsMessage);

                // Thrown if user denied access to destination
                throw new SINotAuthorizedException(nlsMessage);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "checkInquireAuthority");
    }
564243
def _check_email_match(self, user, email):
        
        if user.email != email:
            # The passed email address doesn't match this username's email address.
            # Assume a problem and fail.
            raise CommandError(
                _(
                    'Skipping user "{}" because the specified and existing email '
                    'addresses do not match.'
                ).format(user.username)
            )
245196
def check_auth(user):
    '''
    
    '''

    # Initialize authentication
    auth = None
    person = None

    # Check if there is an user
    if user:

        # It means that Django accepted the user and it is active
        if user.is_staff or user.is_superuser:
            # This is an administrator, let it in
            auth = user
        else:
            # It is a normal user, check if there is a person behind
            person = getattr(user, "person", None)
            if not person:
                # Check if there is related one
                person_related = getattr(user, "people", None)
                if person_related:
                    # Must be only one
                    if person_related.count() == 1:
                        person = person_related.get()

            if person and ((person.disabled is None) or (person.disabled > timezone.now())):
                # There is a person, no disabled found or the found one is fine to log in
                auth = user

    # Return back the final decision
    return auth
178766
def _is_admin(user_id):
    
    user = get_session().query(User).filter(User.id==user_id).one()

    if user.is_admin():
        return True
    else:
        return False
528608
def has_read_permission(self, request, path):
        
        user = request.user
        if not user.is_authenticated():
            return False
        elif user.is_superuser:
            return True
        elif user.is_staff:
            return True
        else:
            return False
252530
def can_approve(self, user, **data):
        
        is_admin = user.is_admin()
        is_reseller_preverifying = user.is_reseller() and data.get('pre_verified', False)
        raise Return(is_admin or is_reseller_preverifying)
831898
private static boolean hasSomeUser() {
        for (User u : User.getAll())
            if(u.getProperty(Details.class)!=null)
                return true;
        return false;
    }
1062772
def _matches_location(price, location):
    """"""
    # the price has no location restriction
    if not price.get('locationGroupId'):
        return True

    # Check to see if any of the location groups match the location group
    # of this price object
    for group in location['location']['location']['priceGroups']:
        if group['id'] == price['locationGroupId']:
            return True

    return False
176441
protected boolean checkNewEntry(String name, int arrayPosition) {

        m_errorMessages.clear();
        boolean inArray = false;
        if (getTypes(false)[arrayPosition] != null) {
            inArray = true;
        }
        if (!inArray) {
            m_errorMessages.add(key(Messages.ERR_PERMISSION_SELECT_TYPE_0));
        }
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(name)) {
            m_errorMessages.add(key(Messages.ERR_MISSING_GROUP_OR_USER_NAME_0));
        }
        if (m_errorMessages.size() > 0) {
            return false;
        }
        return true;
    }
967808
def check_user_by_name(user_name, u_pass):
        '''
        
        '''
        the_query = TabMember.select().where(TabMember.user_name == user_name)
        if the_query.count() == 0:
            return -1

        the_user = the_query.get()
        if the_user.user_pass == tools.md5(u_pass):
            return 1
        return 0
1026327
def has_permission(self, request):
        
        if not super(AdminSiteOTPRequiredMixin, self).has_permission(request):
            return False
        return request.user.is_verified()
1085877
final void verifyExistingDestination() {
        PartitionReplica destination = migrationInfo.getDestination();
        Member target = getNodeEngine().getClusterService().getMember(destination.address(), destination.uuid());
        if (target == null) {
            throw new TargetNotMemberException("Destination of migration could not be found! => " + toString());
        }
    }
540443
public boolean isUserGuest(String userName) {

        if (CmsStringUtil.isEmptyOrWhitespaceOnly(userName)) {
            return false;
        }
        return m_userGuest.equals(userName);
    }
923416
def _sanity_check_registered_locations_parent_locations(query_metadata_table):
    """"""
    for location, location_info in query_metadata_table.registered_locations:
        if (location != query_metadata_table.root_location and
                not query_metadata_table.root_location.is_revisited_at(location)):
            # If the location is not the root location and is not a revisit of the root,
            # then it must have a parent location.
            if location_info.parent_location is None:
                raise AssertionError(u'Found a location that is not the root location of the query '
                                     u'or a revisit of the root, but does not have a parent: '
                                     u'{} {}'.format(location, location_info))

        if location_info.parent_location is not None:
            # Make sure the parent_location is also registered.
            # If the location is not registered, the following line will raise an error.
            query_metadata_table.get_location_info(location_info.parent_location)
1061929
function CheckUserExists(
      $user = '',
      $no_server_check = FALSE,
      $no_error = FALSE
  ) {
      $check_user = ('' != $user)?$user:$this->GetUser();
      $result = FALSE;

      if ('' != trim($check_user)) {
          $server_result = -1;
          if ((!$no_server_check) && ('' != $this->GetServerUrl())) {
              $server_result = $this->CheckUserExistsOnServer($check_user);
              if (22 == $server_result) {
                  // We return only if the user exists, so we check also the local one
                  $result = TRUE;
                  return $result;
              }
          }

          if ((($this->GetBackendTypeValidated()) && ('' != $this->_config_data['sql_users_table'])) || ('files' == $this->GetBackendType())) {
              switch ($this->GetBackendType()) {
                  case 'mysql':
                      if ($this->OpenMysqlDatabase()) {
                          $sQuery  = "SELECT * FROM `".$this->_config_data['sql_users_table']."` WHERE `user` = '{$check_user}'";
                          
                          if (is_object($this->_mysqli)) {
                              if (!($rResult = $this->_mysqli->query($sQuery))) {
                                  $this->WriteLog("Error: Unable to access the database: ".trim($this->_mysqli->error), FALSE, FALSE, 41, 'System', '', 3);
                              } else {
                                  $num_rows = $rResult->num_rows;
                              }
                          }
                          elseif (!($rResult = mysql_query($sQuery, $this->_mysql_database_link))) {
                              $this->WriteLog("Error: Unable to access the database: ".mysql_error(), FALSE, FALSE, 41, 'System', '', 3);
                          } else {
                              $num_rows = mysql_num_rows($this->_mysql_database_link);
                          }
                          
                          if (0 == $num_rows) {
                              if (!$no_error) {
                                  $this->WriteLog("Error: User ".$check_user." does not exist", FALSE, FALSE, 21, 'System', '');
                              }
                              $result = FALSE;
                          } else {
                              $result = TRUE;
                          }
                      }
                      break;
                  case 'pgsql':
                      if ($this->OpenPGSQLDatabase()) {
                          $sQuery  = "SELECT * FROM \"".$this->_config_data['sql_schema']."\".\"".$this->_config_data['sql_users_table']."\" WHERE \"user\" = '{$check_user}';";
                          
                          if (!($rResult = pg_query($this->_pgsql_database_link, $sQuery))) {
                              $this->WriteLog("Error: Unable to access the database: ".pg_last_error(), FALSE, FALSE, 41, 'System', '', 3);
                          } else {
                              $num_rows = pg_num_rows($rResult);
                          }
                          
                          if (0 == $num_rows) {
                              if (!$no_error) {
                                  $this->WriteLog("Error: User ".$check_user." does not exist", FALSE, FALSE, 21, 'System', '');
                              }
                              $result = FALSE;
                          } else {
                              $result = TRUE;
                          }
                      }
                      break;
                  case 'files':
                  default:
                      $user_filename = $this->EncodeFileId($check_user, $this->IsCaseSensitiveUsers()).'.db';
                      if (!file_exists($this->GetUsersFolder().$user_filename)) {
                          $user_filename = $this->EncodeFileId($check_user, $this->IsCaseSensitiveUsers(), TRUE).'.db';
                      }
                      $result = file_exists($this->GetUsersFolder().$user_filename);
                      break;
              }
          }
      }
      return $result;
  }