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/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module User::Assets
|
class User
|
||||||
|
module Assets
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
||||||
|
@ -20,68 +21,68 @@ returns
|
||||||
|
|
||||||
=end
|
=end
|
||||||
|
|
||||||
def assets (data)
|
def assets (data)
|
||||||
|
|
||||||
if !data[ User.to_app_model ]
|
if !data[ User.to_app_model ]
|
||||||
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]
|
|
||||||
}
|
|
||||||
end
|
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
|
# get linked accounts
|
||||||
if attributes['role_ids']
|
attributes['accounts'] = {}
|
||||||
attributes['role_ids'].each {|role_id|
|
authorizations = self.authorizations()
|
||||||
role = Role.lookup( id: role_id )
|
authorizations.each do | authorization |
|
||||||
data = role.assets( data )
|
attributes['accounts'][authorization.provider] = {
|
||||||
}
|
uid: authorization[:uid],
|
||||||
end
|
username: authorization[:username]
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# get groups
|
data[ User.to_app_model ][ self.id ] = attributes
|
||||||
if attributes['group_ids']
|
|
||||||
attributes['group_ids'].each {|group_id|
|
|
||||||
group = Group.lookup( id: group_id )
|
|
||||||
data = group.assets( data )
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
# get groups
|
# get roles
|
||||||
if attributes['organization_ids']
|
if attributes['role_ids']
|
||||||
attributes['organization_ids'].each {|organization_id|
|
attributes['role_ids'].each {|role_id|
|
||||||
organization = Organization.lookup( id: organization_id )
|
role = Role.lookup( id: role_id )
|
||||||
data = organization.assets( data )
|
data = role.assets( data )
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if self.organization_id
|
# get groups
|
||||||
if !data[ Organization.to_app_model ] || !data[ Organization.to_app_model ][ self.organization_id ]
|
if attributes['group_ids']
|
||||||
organization = Organization.lookup( id: self.organization_id )
|
attributes['group_ids'].each {|group_id|
|
||||||
data = organization.assets( data )
|
group = Group.lookup( id: group_id )
|
||||||
end
|
data = group.assets( data )
|
||||||
end
|
}
|
||||||
['created_by_id', 'updated_by_id'].each {|item|
|
end
|
||||||
if self[ item ]
|
|
||||||
if !data[ User.to_app_model ][ self[ item ] ]
|
# get groups
|
||||||
user = User.lookup( id: self[ item ] )
|
if attributes['organization_ids']
|
||||||
data = user.assets( data )
|
attributes['organization_ids'].each {|organization_id|
|
||||||
|
organization = Organization.lookup( id: organization_id )
|
||||||
|
data = organization.assets( data )
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
if self.organization_id
|
||||||
data
|
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
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module User
|
class User
|
||||||
module Permission
|
module Permission
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module User
|
class User
|
||||||
module Search
|
module Search
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
|
||||||
|
|
||||||
module User
|
class User
|
||||||
module SearchIndex
|
module SearchIndex
|
||||||
|
|
||||||
=begin
|
=begin
|
||||||
|
|
|
@ -31,7 +31,8 @@ Zammad::Application.configure do
|
||||||
config.assets.debug = true
|
config.assets.debug = true
|
||||||
|
|
||||||
# Automatically inject JavaScript needed for LiveReload
|
# Automatically inject JavaScript needed for LiveReload
|
||||||
config.middleware.use(Rack::LiveReload,
|
config.middleware.use(
|
||||||
|
Rack::LiveReload,
|
||||||
min_delay: 500, # default 1000
|
min_delay: 500, # default 1000
|
||||||
max_delay: 10_000, # default 60_000
|
max_delay: 10_000, # default 60_000
|
||||||
live_reload_port: 35_738,
|
live_reload_port: 35_738,
|
||||||
|
|
Loading…
Reference in a new issue