users whichare seen only by administrators)
973211
@Transactional(readOnly = true)
	@Profile
	public int countEntityChildrenById(String id) throws NotFoundException {
		return storageDao.countEntityChildrenById(id);
	}
516537
def user_exists(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    return name in list_users(runas=runas)
898525
def list_users(runas=None):
    '''
    
    '''
    # Windows runas currently requires a password.
    # Due to this, don't use a default value for
    # runas in Windows.
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    res = __salt__['cmd.run_all'](
        [RABBITMQCTL, 'list_users', '-q'],
        reset_system_locale=False,
        runas=runas,
        python_shell=False)

    # func to get tags from string such as "[admin, monitoring]"
    func = lambda string: [x.strip() for x in string[1:-1].split(',')] if ',' in string else [x for x in
                                                                                              string[1:-1].split(' ')]
    return _output_to_dict(res, func)
537381
def list_users(root=None):
    '''
    
    '''
    if root is not None:
        getspall = functools.partial(_getspall, root=root)
    else:
        getspall = functools.partial(spwd.getspall)

    return sorted([user.sp_namp if hasattr(user, 'sp_namp') else user.sp_nam
                   for user in getspall()])
1270335
def get_users():
    '''
    
    '''
    try:
        recs = psutil.users()
        return [dict(x._asdict()) for x in recs]
    except AttributeError:
        # get_users is only present in psutil > v0.5.0
        # try utmp
        try:
            import utmp  # pylint: disable=import-error

            result = []
            while True:
                rec = utmp.utmpaccess.getutent()
                if rec is None:
                    return result
                elif rec[0] == 7:
                    started = rec[8]
                    if isinstance(started, tuple):
                        started = started[0]
                    result.append({'name': rec[4], 'terminal': rec[2],
                                   'started': started, 'host': rec[5]})
        except ImportError:
            return False
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
440839
def user_absent(name, htpasswd_file=None, runas=None):
    '''
    

    '''
    ret = {'name': name,
           'changes': {},
           'comment': '',
           'result': None}

    exists = __salt__['file.grep'](
        htpasswd_file, '^{0}:'.format(name))['retcode'] == 0

    if not exists:
        if __opts__['test']:
            ret['result'] = None
        else:
            ret['result'] = True
        ret['comment'] = 'User already not in file'
    else:
        if __opts__['test']:
            ret['result'] = None
            ret['comment'] = 'User \'{0}\' is set to be removed from htpasswd file'.format(name)
            ret['changes'] = {name: True}
        else:
            userdel_ret = __salt__['webutil.userdel'](
                htpasswd_file, name, runas=runas, all_results=True)

            ret['result'] = userdel_ret['retcode'] == 0
            ret['comment'] = userdel_ret['stderr']

            if ret['result']:
                ret['changes'] = {name: True}

    return ret
740106
def visible_to_user(self, user):
        

        return (Event.objects.filter(approved=True).filter(Q(groups__in=user.groups.all()) | Q(groups__isnull=True) | Q(user=user)))
1331847
public function getAdminCanditates()
    {
        $viewer = get_viewer();
        $query = $this->getService('repos:people.person')->getQuery();

        //super admin can make anyone admin
        if (!$viewer->admin()) {
            $ids = $this->_mixer->followerIds->toArray();
            $ids = array_merge($ids, $viewer->followerIds->toArray());
            $query->id($ids)->id($viewer->id, '<>')->id($this->administratorIds->toArray(), '<>');
        }

        return $query->toEntitySet();
    }
547186
public function list_all_admins()
    {
        if (!$this->is_loggedin) {
            return false;
        }

        $response = $this->exec_curl('/api/stat/admin');

        return $this->process_response($response);
    }
1048799
def list_users(root=None):
    '''
    
    '''
    if root is not None and __grains__['kernel'] != 'AIX':
        getpwall = functools.partial(_getpwall, root=root)
    else:
        getpwall = functools.partial(pwd.getpwall)

    return sorted([user.pw_name for user in getpwall()])
480099
def get_users_for_assigned_to():
    
    User = get_user_model()
    return User.objects.filter(is_active=True, is_staff=True)
73719
public function restrictAdminBarVisibility()
    {
        // Don't go further if not logged in or within admin panel
        if (is_admin() || !is_user_logged_in())
        {
            return;
        }

        $data = $this->getData();

        // Don't go further if no setting
        if ( !isset($data['admin_bar']) || empty($data['admin_bar']))
        {
            return;
        }

        $access = $data['admin_bar'];

        // Is current user's role within our access roles?
        $user = wp_get_current_user();
        $role = $user->roles;
        $role = (count($role) > 0) ? $role[0] : '';
        $isUserIncluded = in_array($role, $access['roles']);

        // Hide admin bar if required
        if (($access['mode'] == 'show' && !$isUserIncluded)
            || ($access['mode'] == 'hide' && $isUserIncluded)
        )
        {
            show_admin_bar(false);
        }
    }
410723
public function countVisibleUsers()
    {
        $roleSuperAdmin = 'ROLE_SUPER_ADMIN';

        if ($this->securityContext->isGranted($roleSuperAdmin)) {
            $count = $this->userManager->countUsers();
        } else {
            $count = $this->userManager->countUsersExcludingRole($roleSuperAdmin);
        }

        return $count;
    }
1139876
def get_admins(self):
        """"""
        # no nickserv support, assume people are who they say they are.
        if not self.config['feature'].getboolean('nickserv'):
            return
        with self.db.session_scope() as session:
            for a in session.query(orm.Permissions).all():
                if not a.registered:
                    self.update_authstatus(a.nick)
172126
def can_access(self, user):
        
        return self.class_.is_admin(user) or \
            self.is_ready and self.class_ in user.classes
936341
def get_specific_user():
    '''
    
    '''
    user = get_user()
    if salt.utils.platform.is_windows():
        if _win_current_user_is_admin():
            return 'sudo_{0}'.format(user)
    else:
        env_vars = ('SUDO_USER',)
        if user == 'root':
            for evar in env_vars:
                if evar in os.environ:
                    return 'sudo_{0}'.format(os.environ[evar])
    return user