Skip to content

Commit 6ab878d

Browse files
authored
Merge pull request #874 from jbonnet/859-POST-licences-fails
Fix POST headers (JSON) and user validation by UUID
2 parents aa3763e + 5b04712 commit 6ab878d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

son-gtkapi/models/licence_manager_service.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ def self.valid?(params)
5959
def self.create(params)
6060
method = LOG_MESSAGE + "##{__method__}"
6161
GtkApi.logger.debug(method) {"entered: params=#{params}"}
62-
headers = {'Content-Type'=>'application/x-www-form-urlencoded'}
62+
#headers = {'Content-Type'=>'application/x-www-form-urlencoded'}
6363

6464
begin
6565
self.valid?(params)
66-
licence = postCurb(url: @@url+LICENCES_URL, body: params, headers: headers)
66+
params[:description] = 'Default description]'
67+
licence = postCurb(url: @@url+LICENCES_URL, body: params) #, headers: headers)
6768
GtkApi.logger.debug(method) {"licence=#{licence}"}
6869

6970
case licence[:status]

son-gtkapi/models/user.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def save_public_key(params, token)
269269
def self.valid?(params)
270270
method = LOG_MESSAGE + "##{__method__}"
271271
GtkApi.logger.debug(method) {"entered with params #{params}"}
272-
true
272+
User.find_by_uuid(params[:user_uuid])
273273
end
274274

275275
def self.find_by_uuid(uuid)

0 commit comments

Comments
 (0)