Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 0194b435 authored by hellekin's avatar hellekin

Add authorization policies for Collection and Resource

- Resources have a bug deeply nested into something that does not
  exactly send back a useful error message...
parent 256fa5b9
......@@ -2,13 +2,14 @@
class Api::V0::CollectionsController < ApplicationController
def index
@collections = Collection.all
@collections = policy_scope(Collection)
render jsonapi: @collections,
include: include_from_params
end
def show
@collection = Collection.find(params[:id])
@collection = policy_scope(Collection).find(params[:id])
authorize @collection
render jsonapi: @collection,
include: include_from_params
end
......
......@@ -2,22 +2,19 @@
class Api::V0::ResourcesController < ApplicationController
def index
@resources = Resource.all
@resources = policy_scope(Resource)
render jsonapi: @resources,
include: include_from_params
rescue INCOMMON::UnknownRelationshipError => e
render_jsonapi_error_unknown_relationship(e.message, model_types)
end
def show
@resource = Resource.find_by(uuid: params[:id])
@resource = policy_scope(Resource).find_by(uuid: params[:id])
authorize @resource
extra_links = { agent: api_agent_url(@resource.agent) } if @resource&.agent&.present?
render jsonapi: @resource,
include: include_from_params,
fields: params[:fields],
links: extra_links
rescue INCOMMON::UnknownRelationshipError => e
render_jsonapi_error_unknown_relationship(e.message, model_types)
end
private
......
# frozen_string_literal: true
class CollectionPolicy < ApplicationPolicy
def index?
true
end
def show?
true
end
def create?
user.editor?
end
def update?
create?
end
def destroy?
user.maintainer?
end
class Scope < Scope
def resolve
scope.all
end
end
end
# frozen_string_literal: true
class ResourcePolicy < ApplicationPolicy
def index?
record_public?
end
def show?
record_public?
end
def create?
user.editor?
end
def update?
create?
end
def destroy?
user.maintainer?
end
class Scope < Scope
def resolve
scope.all
......
......@@ -3,8 +3,6 @@
class SerializableCollection < JSONAPI::Serializable::Resource
type 'collections'
id { @object.uuid }
# attribute :id
attribute :name
attribute :summary
......
# frozen_string_literal: true
class SerializableResource < JSONAPI::Serializable::Resource
class SerializableResource < SerializableIncommonResource
type { @object.type }
id { @object.uuid }
# Mobility translations
attribute :name
attribute :summary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment