Return true if the current user has permission on this
        image. Return the string 'ALL' if the user has all rights.
351354
def has_generic_permission(self, request, permission_type):
        
        user = request.user
        if not user.is_authenticated():
            return False
        elif user.is_superuser:
            return True
        elif user == self.owner:
            return True
        elif self.folder:
            return self.folder.has_generic_permission(request, permission_type)
        else:
            return False
774269
def permission_required(perm, login_url=None):
    

    return user_passes_test(lambda u: u.has_perm(perm), login_url=login_url)
254852
public function hasPermission($permission, $all = false)
    {
        if ($this->isPretendEnabled()) {
            return $this->pretend('hasPermission');
        }

        if (!$all) {
            return $this->hasOnePermission($permission);
        }

        return $this->hasAllPermissions($permission);
    }
488402
public static boolean hasPermissions(Context context, String[]... permissions) {
        for (String[] permission : permissions) {
            boolean hasPermission = PERMISSION_CHECKER.hasPermission(context, permission);
            if (!hasPermission) return false;
        }
        return true;
    }
929044
def has_permission_to_view(page, user):
    
    if page.permissions.count() == 0:
        return True
    for perm in page.permissions.all():
        perm_label = '%s.%s' % (perm.content_type.app_label, perm.codename)
        if user.has_perm(perm_label):
            return True
    return False
375663
def has_permission(self, request, *args, **kwargs):
        
        self.kwargs = kwargs
        self.args = args
        self.request = request

        if not getattr(self, 'permission', None):
            return True
        else:
            return request.user.has_perm(self.permission)
171799
def has_object_permission(self, request, view, obj):
        

        user = request.user

        if not user.is_superuser and not user.is_anonymous():
            valid = False
            try:
                ct = ContentType.objects.get_for_model(obj)
                fpm = FilterPermissionModel.objects.get(user=user,
                                                        content_type=ct)
                myq = QSerializer(base64=True).loads(fpm.filter)
                try:
                    myobj = obj.__class__.objects.filter(myq).distinct().get(pk=obj.pk)
                    if myobj:
                        valid = True
                except ObjectDoesNotExist:
                    valid = False
            except ObjectDoesNotExist:
                valid = True
            finally:
                return valid
        else:
            return True
233002
def access(self, user):
        """"""
        if self.denyusers:
            if user in self.denyusers:
                return False
        if self.allowusers:
            if not user in self.allowusers:
                return False
        return True
1039429
def user_has_access(self, user):
        
        if ROLE_ADMIN in user.roles:
            return True

        # Non-admin users should only see active accounts
        if self.enabled:
            if not self.required_roles:
                return True

            for role in self.required_roles:
                if role in user.roles:
                    return True

        return False
1132332
def has_permission(self, request):
        """"""
        if not self.object and not self.permission:
            return True

        if not self.permission:
            return request.user.has_perm('{}_{}'.format(
                self.model_permission,
                self.object.__class__.__name__.lower()), self.object
            )

        return request.user.has_perm(self.permission)
830490
def has_any_permissions(self, user):
        
        for perm in self.get_all_model_permissions():
            if self.has_specific_permission(user, perm.codename):
                return True
        return False
698230
def get_permissions(self):
        
        user_role = self.last_login_role() if self.last_login_role_key else self.role_set[0].role
        return user_role.get_permissions()
424554
def has_permissions(self, object, group, operations):
        ''''''
        if self.is_superuser:
            return 1
        else:
            models = self.session.router
            # valid permissions
            query = models.permission.for_object(object, operation=operations)
            objects = models[models.role.permissions.model]
            return objects.filter(role=self.role.query(),
                                  permission=query).count()
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
376043
public function hasSuperUser()
    {

        $permissions = $this->getAllPermissions();

        foreach ($permissions as $permission)
            if ($permission === 'superuser') return true;

        return false;
    }
1089482
def has_permission(user, *permissions, **role_kwargs):
    
    Role = get_model('role')
    Perm = get_model('permission')
    if isinstance(user, (unicode, str)):
        User = get_model('user')
        user = User.get(User.c.username==user)
        
    for name in permissions:
        perm = Perm.get(Perm.c.name==name)
        if not perm:
            continue
        
        flag = has_role(user, *list(perm.perm_roles.with_relation().all()), **role_kwargs)
        if flag:
            return flag
        
    return False
35187
def has_permission(self, user):
        
        return user.has_perm(
            self.model._meta.app_label + '.' + self.get_permission()
        )