Returns True if self has the same or fewer permissions as other.
484832
def is_subset(self, other):
        """"""
        if isinstance(other, Permissions):
            return (self.value & other.value) == self.value
        else:
            raise TypeError("cannot compare {} with {}".format(self.__class__.__name__, other.__class__.__name__))
220886
public boolean hasPermissionById(String id, Permission permission) {
        return hasPermissionsById(id, ImmutableList.of(permission));
    }
322553
public static boolean sameMembers(View v1, View v2) {
        if(v1 == v2)
            return true;
        if(v1.size() != v2.size())
            return false;
        Address[][] diff=diff(v1, v2);
        return diff[0].length == 0 && diff[1].length == 0;
    }
1076655
public boolean hasPermissionsById(String id, Collection<Permission> permissions) {
        AuthorizationInfo authorizationInfo = getAuthorizationInfoById(id);
        return authorizationInfo != null && isPermittedAll(permissions, authorizationInfo);
    }
466908
public boolean hasPermissionsById(String id, Permission... permissions) {
        return hasPermissionsById(id, Arrays.asList(permissions));
    }
1232966
public boolean hasPermission(final ApiKey apiKey, String permissionName) {
        if (apiKey.getTeams() == null) {
            return false;
        }
        for (final Team team: apiKey.getTeams()) {
            final List<Permission> teamPermissions = getObjectById(Team.class, team.getId()).getPermissions();
            for (final Permission permission: teamPermissions) {
                if (permission.getName().equals(permissionName)) {
                    return true;
                }
            }
        }
        return false;
    }
489729
def in_same_box(self, a, b):
        """"""
        assert a in self.micro_indices
        assert b in self.micro_indices

        for part in self.partition:
            if a in part and b in part:
                return True

        return False
858500
def has_permissions(self):
        
        perms = self.request('/me/permissions')['data'][0].keys()
        return all(k in perms for k in app.config[
            'CANVAS_SCOPE'].split(','))
351939
public boolean hasStopPermission() {
        lock.readLock().lock();
        try {
            return executable != null && getParentOf(executable).getOwnerTask().hasAbortPermission();
        } finally {
            lock.readLock().unlock();
        }
    }
829346
def has_perm(self, perm):
        
        if '.' in perm:
            app_label, codename = perm.split('.')
            permissions = self.permissions.filter(
                content_type__app_label = app_label, 
                codename = codename)
            groups = self.groups.filter(
                permissions__content_type__app_label = app_label,
                permissions__codename = codename )
        else:
            permissions = self.permissions.filter(codename = perm)
            groups = self.groups.filter(permissions__codename = perm)
        return permissions.exists() or groups.exists()
1131255
public boolean hasPermissionsById(String id, String... permissions) {
        List<Permission> resolvedPermissions = Lists.newArrayListWithCapacity(permissions.length);
        for (String permission : permissions) {
            resolvedPermissions.add(getPermissionResolver().resolvePermission(permission));
        }
        return hasPermissionsById(id, resolvedPermissions);
    }
1369236
def has_permission(cls, user):
        
        # no login is needed, so its always fine
        if not cls.requires_login:
            return True

        # if user is somehow not logged in
        if not user.is_authenticated:
            return False

        # attribute permission_required is mandatory, returns tuple
        perms = cls.get_permission_required()
        # if perms are defined and empty, we skip checking
        if not perms:
            return True

        # get role of user, skip admin role
        role = user.urole.role.name
        if role == cls.ADMIN:
            return True

        # check if at least one permissions is valid
        for permission in perms:
            if cls.check_permission(role, permission):
                return True

        # permission denied
        return False
901386
def has_permission(self, perm):
        
        return self.user.superuser or self.auth.has_permission(perm)
555666
public function hasAccessRestrictions()
    {
        if (!is_array($this->accessRoles) || empty($this->accessRoles)) {
            return false;
        }
        if (count($this->accessRoles) === 1 && in_array('Neos.Flow:Everybody', $this->accessRoles)) {
            return false;
        }

        return true;
    }
338563
def permissions_match(self, path):
        
        audit = FilePermissionAudit(path, self.user, self.group, self.mode)
        return audit.is_compliant(path)
422698
def check_permission(self, request):
        
        return all((permission.has_permission(request) for permission in self.permission_classes))
585875
def has_perm(self, perm, obj, check_groups=True, approved=True):
        
        if self.user:
            if self.has_user_perms(perm, obj, approved, check_groups):
                return True
        if self.group:
            return self.has_group_perms(perm, obj, approved)
        return False