List a specific permisison for the given object.

        :param str permission_id: the id of the Permission to be listed.
483398
def get(self, permission_id, expand=[]):
        
        parent_url = self.client.get_url(self.parent_object._manager._URL_KEY, 'GET', 'single', {'id': self.parent_object.id})
        target_url = parent_url + self.client.get_url_path(
            self._URL_KEY, 'GET', 'single', {'permission_id': permission_id})
        return self._get(target_url, expand=expand)
992806
def has_add_permission(self, request):
        
        perm_string = '%s.add_%s' % (self.model._meta.app_label,
            self.model._meta.object_name.lower()
        )
        return request.user.has_perm(perm_string)
9866
public void addPermission(Permission permission) {
        if ((securityManager != null) && (permission != null)) {
            permissionList.add(permission);
        }
    }
175676
def request_permission(cls, permissions):
        
        app = AndroidApplication.instance()
        f = app.create_future()

        def on_result(perms):
            allowed = True
            for p in permissions:
                allowed = allowed and perms.get(p, False)
            f.set_result(allowed)

        app.request_permissions(permissions).then(on_result)

        return f
1166927
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_add_post(obj, user)
546909
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_vote_in_poll(obj, user)
1370783
def _populate_permissions(resources, content_type_id):
    
    from django.contrib.auth.models import Permission
    # read the whole auth_permission table into memory
    db_perms = [perm.codename for perm in Permission.objects.all()]

    for resource in resources:
        # get all resource's permissions that are not already in db
        perms = [perm for perm in resource.access_controller.get_perm_names(resource) if perm not in db_perms]
        for perm in perms:
            _save_new_permission(perm, content_type_id)
380689
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_move_topics(obj, user)
961887
def get_requested_aosp_permissions(self):
        
        aosp_permissions = []
        all_permissions = self.get_permissions()
        for perm in all_permissions:
            if perm in list(self.permission_module.keys()):
                aosp_permissions.append(perm)
        return aosp_permissions
1259106
def __get_permissions(self, res, **kwargs):
        
        response = res._(**kwargs)
        return response.get('permissions', None)
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)
1099184
def verify_and_sort_permissions
      # DefaultPermissionSet is allowed to have blank permissions (private joinable), the other models need at least find and view
      self.permissions += [:find, :view] unless is_a?(DefaultPermissionSet)
    
      raise "Invalid permissions: #{(permissions - allowed_permissions).inspect}. Must be one of #{allowed_permissions.inspect}" unless permissions.all? {|permission| allowed_permissions.include? permission}
    
      self.permissions = permissions.uniq.sort_by { |permission| allowed_permissions.index(permission) }
    end
311468
def permissions(self):
        
        can_read = self._info.file.permissions & lib.GP_FILE_PERM_READ
        can_write = self._info.file.permissions & lib.GP_FILE_PERM_DELETE
        return "{0}{1}".format("r" if can_read else "-",
                               "w" if can_write else "-")
255739
def validate_permission(self, key, permission):
        
        if permission.perm_name not in self.__possible_permissions__:
            raise AssertionError(
                "perm_name is not one of {}".format(self.__possible_permissions__)
            )
        return permission
945189
def check_permissions(self, request):
        """"""
        objs = [None]
        if hasattr(self, 'get_perms_objects'):
            objs = self.get_perms_objects()
        else:
            if hasattr(self, 'get_object'):
                try:
                    objs = [self.get_object()]
                except Http404:
                    raise
                except:
                    pass
            if objs == [None]:
                objs = self.get_queryset()
            if len(objs) == 0:
                objs = [None]

        if (hasattr(self, 'permission_filter_queryset') and
           self.permission_filter_queryset is not False and
           self.request.method == 'GET'):
            if objs != [None]:
                self.perms_filter_queryset(objs)
        else:
            has_perm = check_perms(self.request.user,
                                   self.get_permission_required(),
                                   objs, self.request.method)

            if not has_perm:
                msg = self.get_permission_denied_message(
                    default="Permission denied."
                )
                if isinstance(msg, Sequence):
                    msg = msg[0]
                self.permission_denied(request, message=msg)
839669
def has_object_permission(self, request, view, obj):
        
        return (
            request.user.is_superuser or
            super(IAWPOrSuperuser, self).has_object_permission(
                request=request, view=view, obj=obj
            )
        )
479913
def has_permission(self, permission, obj=None):
        
        if not permission:
            logger.warn("None permission is not allowed")
            return False
        if obj is None:
            return check_permission(permission, self.context)
        return check_permission(permission, api.get_object(obj))