Sha256: db2795b5cb0b0c42ff6a8e84a93c3905aff3bff30deb2243ff36076c88a27bf5
Contents?: true
Size: 944 Bytes
Versions: 54
Compression:
Stored size: 944 Bytes
Contents
module Faalis module API class GroupsAPI < Grape::API resource :groups do desc "Return all the groups" get do authenticated_user # TODO: Check for admin user only Faalis::Group.includes(:permissions) end delete do authenticated_user #if can? :delete, Group #end Group.delete(params[:id].split(",")) end post do authenticated_user permissions = []; params[:permissions].each do |perm_string| perm, model = perm_string.split "|" permission = Permission.find_or_create_by_model_and_permission_type(model, perm) permissions << permission end Group.create!({ name: params[:name], permissions: permissions, }) end end end end end
Version data entries
54 entries across 54 versions & 1 rubygems