app/controllers/scrivito/sessions_controller.rb in scrivito_sdk-1.6.1 vs app/controllers/scrivito/sessions_controller.rb in scrivito_sdk-1.7.0.rc1
- old
+ new
@@ -1,7 +1,27 @@
module Scrivito
class SessionsController < WebserviceController
def update
- @session = Session.renew(params[:id], scrivito_user)
+ @session = fetch_session(params.fetch(:id))
+ end
+
+ private
+
+ def fetch_session(id)
+ payload = {
+ session: {
+ role: 'editor',
+ user_id: scrivito_user.id,
+ permissions: permissions(scrivito_user),
+ }
+ }
+
+ CmsRestApi.task_unaware_request(:put, "sessions/#{id}", payload)
+ end
+
+ def permissions(user)
+ Hash[user.explicit_rules.map do |permission, verb, _, _|
+ [verb, permission.to_s]
+ end]
end
end
end