// IsAdminUser tests whether the current user belongs to the administrative
// users group.
//
// If the user is not, a MembershipError will be returned.
494591
func IsAdminUser(c context.Context) error {
	cfg, err := GetConfigProvider(c).Config(c)
	if err != nil {
		return err
	}
	return checkMember(c, cfg.Coordinator.AdminAuthGroup)
}
152101
func (d *dcosInfo) IsLeader() (bool, error) {
	// find role and IP before locking the structure.
	localIP, err := d.DetectIP()
	if err != nil {
		return false, err
	}

	d.Lock()
	defer d.Unlock()

	if d.cache && d.cachedIsLeader != nil {
		return *d.cachedIsLeader, nil
	}

	// agent cannot be leader
	if d.role != dcos.RoleMaster {
		return false, nil
	}

	addrs, err := net.LookupIP(d.dnsRecordLeader)
	if err != nil {
		return false, err
	}

	for _, addr := range addrs {
		if localIP.Equal(addr) {
			isLeader := true

			if d.cache {
				d.cachedIsLeader = &isLeader
			}

			return isLeader, nil
		}
	}

	return false, ErrNodeInfo{fmt.Sprintf("Error getting mesos leader. Number of ip addresses %d", len(addrs))}
}
336126
func (m *Manager) FilterUsersWithAuthorizations(usernames []string, organization string) ([]string, error) {
	var auths []Authorization
	err := m.getAuthorizationCollection().Find(bson.M{"username": bson.M{"$in": usernames}, "grantedto": organization}).Select(bson.M{"username": 1}).All(&auths)
	if err != nil {
		return nil, err
	}
	result := []string{}
	for _, auth := range auths {
		result = append(result, auth.Username)
	}
	return result, nil
}
911728
func (auup *AuthUserUserPermission) AuthUser(db XODB) (*AuthUser, error) {
	return AuthUserByID(db, auup.UserID)
}
731270
func (o *Ownership) IsUserAllowedByGroup(
	user *auth.UserInfo,
	accessType Ownership_AccessType,
) bool {

	// Allow if it is the admin user for any group
	if o.IsAdminByUser(user) {
		return true
	}

	ownergroups := o.GetGroups()
	if len(ownergroups) == 0 {
		return false
	}

	// Check each of the groups from the user
	for _, group := range user.Claims.Groups {
		// Check if the user group has permission
		if a, ok := ownergroups[group]; ok {
			return a.isAccessPermitted(accessType)
		}
	}

	// Check if any group is allowed
	if a, ok := ownergroups["*"]; ok {
		return a.isAccessPermitted(accessType)
	}

	return false
}
1250100
func (db *SnapshotDB) IsMember(c context.Context, id identity.Identity, groups []string) (bool, error) {
	// TODO(vadimsh): Optimize multi-group case.
	for _, gr := range groups {
		switch found, err := db.isMemberImpl(c, id, gr); {
		case err != nil:
			return false, err
		case found:
			return true, nil
		}
	}
	return false, nil
}
40409
func isAdminReq(r *http.Request) bool {
	return strings.HasPrefix(r.URL.Path, adminAPIPathPrefix+"/")
}
13318
func (s *IssuesService) IsAssignee(ctx context.Context, owner, repo, user string) (bool, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/assignees/%v", owner, repo, user)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return false, nil, err
	}
	resp, err := s.client.Do(ctx, req, nil)
	assignee, err := parseBoolResponse(err)
	return assignee, resp, err
}
563013
func (c *client) getAuthUser() string {
	switch {
	case c.opts.Nkey != "":
		return fmt.Sprintf("Nkey %q", c.opts.Nkey)
	case c.opts.Username != "":
		return fmt.Sprintf("User %q", c.opts.Username)
	default:
		return `User "N/A"`
	}
}
270494
func (_class AuthClass) GetGroupMembership(sessionID SessionRef, subjectIdentifier string) (_retval []string, _err error) {
	_method := "auth.get_group_membership"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_subjectIdentifierArg, _err := convertStringToXen(fmt.Sprintf("%s(%s)", _method, "subject_identifier"), subjectIdentifier)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _subjectIdentifierArg)
	if _err != nil {
		return
	}
	_retval, _err = convertStringSetToGo(_method + " -> ", _result.Value)
	return
}
296511
func (c *Client) IsAuthenticated() bool {
	authHeader, ok := c.Headers["Authorization"]

	if !ok || (ok && authHeader == "token ") {
		return false
	}

	return true
}
1225200
func IsUserAbortedError(err error) bool {
	_, ok := errors.Cause(err).(userAbortedError)
	return ok
}
1365081
public static boolean isAdmin(IGroupMember member) {
        IEntityGroup adminGroup = null;

        try {
            adminGroup =
                    GroupService.getDistinguishedGroup(PORTAL_ADMINISTRATORS_DISTINGUISHED_GROUP);
        } catch (GroupsException ge) {
            // cannot determine whether or not the user is an admin.
            cLog.error(
                    "Administrative group not found, cannot determine "
                            + "user's admininstrative membership.",
                    ge);
        }

        return (null != adminGroup && adminGroup.deepContains(member));
    }
74152
func (l *Limiter) GetBasicAuthUsers() []string {
	asMap := l.basicAuthUsers.Items()

	var basicAuthUsers []string
	for basicAuthUser, _ := range asMap {
		basicAuthUsers = append(basicAuthUsers, basicAuthUser)
	}

	return basicAuthUsers
}
833026
func RunningInUserNS() bool {
	uidmap, err := user.CurrentProcessUIDMap()
	if err != nil {
		// This kernel-provided file only exists if user namespaces are supported
		return false
	}
	return UIDMapInUserNS(uidmap)
}
1141694
func (aug *AuthUserGroup) AuthUser(db XODB) (*AuthUser, error) {
	return AuthUserByID(db, aug.UserID)
}
318327
func (le *LeaderElector) IsLeader() bool {
	return le.observedRecord.HolderIdentity == le.config.Lock.Identity()
}