Some new rubocop checks.
This commit is contained in:
parent
60121a25fb
commit
d5ab29474f
5 changed files with 62 additions and 60 deletions
|
@ -1,6 +1,7 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module User::Assets
|
||||
class User
|
||||
module Assets
|
||||
|
||||
=begin
|
||||
|
||||
|
@ -20,68 +21,68 @@ returns
|
|||
|
||||
=end
|
||||
|
||||
def assets (data)
|
||||
def assets (data)
|
||||
|
||||
if !data[ User.to_app_model ]
|
||||
data[ User.to_app_model ] = {}
|
||||
end
|
||||
if !data[ User.to_app_model ][ self.id ]
|
||||
attributes = self.attributes_with_associations
|
||||
|
||||
# do not transfer crypted pw
|
||||
attributes['password'] = ''
|
||||
|
||||
# get linked accounts
|
||||
attributes['accounts'] = {}
|
||||
authorizations = self.authorizations()
|
||||
authorizations.each do | authorization |
|
||||
attributes['accounts'][authorization.provider] = {
|
||||
uid: authorization[:uid],
|
||||
username: authorization[:username]
|
||||
}
|
||||
if !data[ User.to_app_model ]
|
||||
data[ User.to_app_model ] = {}
|
||||
end
|
||||
if !data[ User.to_app_model ][ self.id ]
|
||||
attributes = self.attributes_with_associations
|
||||
|
||||
data[ User.to_app_model ][ self.id ] = attributes
|
||||
# do not transfer crypted pw
|
||||
attributes['password'] = ''
|
||||
|
||||
# get roles
|
||||
if attributes['role_ids']
|
||||
attributes['role_ids'].each {|role_id|
|
||||
role = Role.lookup( id: role_id )
|
||||
data = role.assets( data )
|
||||
}
|
||||
end
|
||||
# get linked accounts
|
||||
attributes['accounts'] = {}
|
||||
authorizations = self.authorizations()
|
||||
authorizations.each do | authorization |
|
||||
attributes['accounts'][authorization.provider] = {
|
||||
uid: authorization[:uid],
|
||||
username: authorization[:username]
|
||||
}
|
||||
end
|
||||
|
||||
# get groups
|
||||
if attributes['group_ids']
|
||||
attributes['group_ids'].each {|group_id|
|
||||
group = Group.lookup( id: group_id )
|
||||
data = group.assets( data )
|
||||
}
|
||||
end
|
||||
data[ User.to_app_model ][ self.id ] = attributes
|
||||
|
||||
# get groups
|
||||
if attributes['organization_ids']
|
||||
attributes['organization_ids'].each {|organization_id|
|
||||
organization = Organization.lookup( id: organization_id )
|
||||
data = organization.assets( data )
|
||||
}
|
||||
end
|
||||
end
|
||||
if self.organization_id
|
||||
if !data[ Organization.to_app_model ] || !data[ Organization.to_app_model ][ self.organization_id ]
|
||||
organization = Organization.lookup( id: self.organization_id )
|
||||
data = organization.assets( data )
|
||||
end
|
||||
end
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
if self[ item ]
|
||||
if !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
data = user.assets( data )
|
||||
# get roles
|
||||
if attributes['role_ids']
|
||||
attributes['role_ids'].each {|role_id|
|
||||
role = Role.lookup( id: role_id )
|
||||
data = role.assets( data )
|
||||
}
|
||||
end
|
||||
|
||||
# get groups
|
||||
if attributes['group_ids']
|
||||
attributes['group_ids'].each {|group_id|
|
||||
group = Group.lookup( id: group_id )
|
||||
data = group.assets( data )
|
||||
}
|
||||
end
|
||||
|
||||
# get groups
|
||||
if attributes['organization_ids']
|
||||
attributes['organization_ids'].each {|organization_id|
|
||||
organization = Organization.lookup( id: organization_id )
|
||||
data = organization.assets( data )
|
||||
}
|
||||
end
|
||||
end
|
||||
}
|
||||
data
|
||||
if self.organization_id
|
||||
if !data[ Organization.to_app_model ] || !data[ Organization.to_app_model ][ self.organization_id ]
|
||||
organization = Organization.lookup( id: self.organization_id )
|
||||
data = organization.assets( data )
|
||||
end
|
||||
end
|
||||
['created_by_id', 'updated_by_id'].each {|item|
|
||||
if self[ item ]
|
||||
if !data[ User.to_app_model ][ self[ item ] ]
|
||||
user = User.lookup( id: self[ item ] )
|
||||
data = user.assets( data )
|
||||
end
|
||||
end
|
||||
}
|
||||
data
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module User
|
||||
class User
|
||||
module Permission
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module User
|
||||
class User
|
||||
module Search
|
||||
|
||||
=begin
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||
|
||||
module User
|
||||
class User
|
||||
module SearchIndex
|
||||
|
||||
=begin
|
||||
|
|
|
@ -31,7 +31,8 @@ Zammad::Application.configure do
|
|||
config.assets.debug = true
|
||||
|
||||
# Automatically inject JavaScript needed for LiveReload
|
||||
config.middleware.use(Rack::LiveReload,
|
||||
config.middleware.use(
|
||||
Rack::LiveReload,
|
||||
min_delay: 500, # default 1000
|
||||
max_delay: 10_000, # default 60_000
|
||||
live_reload_port: 35_738,
|
||||
|
|
Loading…
Reference in a new issue