Class: User

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
models/user.rb

Overview

Represents a Vulnreport user

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods included from DataMapper::Resource

#make_dirty

Class Method Details

+ (Boolean) active(repository = nil)

Returns User is active. False will disable and override all other perms

Returns:

  • (Boolean)

    User is active. False will disable and override all other perms



25
# File 'models/user.rb', line 25

property :active,			Boolean, :default => true

+ (Object) activeSorted



102
103
104
105
# File 'models/user.rb', line 102

def self.activeSorted
	users = all(:active => true, :name.not => nil, :name.not => "")
	users.sort{|x,y| x.name.split(" ").last <=> y.name.split(" ").last }
end

+ (Object) activeUsers



98
99
100
# File 'models/user.rb', line 98

def self.activeUsers
	return all(:active => true)
end

+ (Boolean) admin(repository = nil)

Returns Perm bit. True if is a Vulnreport admin

Returns:

  • (Boolean)

    Perm bit. True if is a Vulnreport admin



30
# File 'models/user.rb', line 30

property :admin,			Boolean, :default => false

+ (Integer) allocCoeff(repository = nil)

Returns The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.

Returns:

  • (Integer)

    The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.



28
# File 'models/user.rb', line 28

property :allocCoeff,		Integer, :default => 200

+ (Integer) approver_orgs(repository = nil)

Returns IDs of Organizations who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Organizations who can approve for this user. Nil if none can.



38
# File 'models/user.rb', line 38

property :approver_orgs,	CommaSeparatedList

+ (Integer) approver_users(repository = nil)

Returns IDs of Users who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Users who can approve for this user. Nil if none can.



37
# File 'models/user.rb', line 37

property :approver_users,	CommaSeparatedList

+ (Boolean) canAuditMonitors(repository = nil)

Returns Perm bit. True if allowed to audit monitor trigger logs

Returns:

  • (Boolean)

    Perm bit. True if allowed to audit monitor trigger logs



32
# File 'models/user.rb', line 32

property :canAuditMonitors,	Boolean, :default => false

+ (Boolean) canPassToCon(repository = nil)

Returns Perm bit. True if allowed to pass an app to a contractor

Returns:

  • (Boolean)

    Perm bit. True if allowed to pass an app to a contractor



34
# File 'models/user.rb', line 34

property :canPassToCon,		Boolean, :default => false

+ (Integer) dashOverride(repository = nil)

Returns ID of DashConfig User has chosen to override default dash for org with. -1 if no override.

Returns:

  • (Integer)

    ID of DashConfig User has chosen to override default dash for org with. -1 if no override.



26
# File 'models/user.rb', line 26

property :dashOverride,		Integer, :default => -1			#@return [Integer] ID of {DashConfig} User has chosen to override default dash for org with. -1 if no override.

+ (GEO) defaultGeo(repository = nil)

Returns Default GEO for User

Returns:

  • (GEO)

    Default GEO for User



24
# File 'models/user.rb', line 24

property :defaultGeo,		Integer, :default => GEO::USA

+ (String) email(repository = nil)

Returns User email address

Returns:

  • (String)

    User email address



20
# File 'models/user.rb', line 20

property :email,			String, :length => 500

+ (String) extEID(repository = nil)

Returns User external EID if separate from SSO ID

Returns:

  • (String)

    User external EID if separate from SSO ID



19
# File 'models/user.rb', line 19

property :extEID,			String

+ (Integer) id(repository = nil)

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/user.rb', line 13

property :id,				Serial

+ (String) initials(repository = nil)

Returns User initials

Returns:

  • (String)

    User initials



22
# File 'models/user.rb', line 22

property :initials,			String

+ (String) name(repository = nil)

Returns User name.

Returns:

  • (String)

    User name.



21
# File 'models/user.rb', line 21

property :name,				String, :length => 100

+ (Integer) org(repository = nil)

Returns Organization ID of org the user belongs to. 0 = unverified

Returns:

  • (Integer)

    Organization ID of org the user belongs to. 0 = unverified



23
# File 'models/user.rb', line 23

property :org,				Integer

+ (String) password(repository = nil)

Returns Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it

Returns:

  • (String)

    Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it



17
# File 'models/user.rb', line 17

property :password,			BCryptHash

+ (Boolean) provPassApprover(repository = nil)

Returns Perm bit. True if allowed to approve provisional pass requests

Returns:

  • (Boolean)

    Perm bit. True if allowed to approve provisional pass requests



33
# File 'models/user.rb', line 33

property :provPassApprover,	Boolean, :default => false

+ (Boolean) reportsOnly(repository = nil)

Returns Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.

Returns:

  • (Boolean)

    Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.



31
# File 'models/user.rb', line 31

property :reportsOnly,		Boolean, :default => false

+ (Boolean) requireApproval(repository = nil)

Returns Perm bit. True if this user needs approval to pass/fail a test

Returns:

  • (Boolean)

    Perm bit. True if this user needs approval to pass/fail a test



35
# File 'models/user.rb', line 35

property :requireApproval,	Boolean, :default => false

+ (String) sso_id(repository = nil)

Returns SSO-passed User EID 005xxx…

Returns:

  • (String)

    SSO-passed User EID 005xxx…



15
# File 'models/user.rb', line 15

property :sso_id,			String

+ (String) sso_user(repository = nil)

Returns SSO-passed username

Returns:

  • (String)

    SSO-passed username



14
# File 'models/user.rb', line 14

property :sso_user,			String, :length => 500

+ (Boolean) useAllocation(repository = nil)

Returns True if this user uses the MonthlyAllocation system

Returns:



27
# File 'models/user.rb', line 27

property :useAllocation,	Boolean, :default => false

+ (String) username(repository = nil)

Returns Non-SSO username. If created via SSO, defaults to sso_user

Returns:

  • (String)

    Non-SSO username. If created via SSO, defaults to sso_user



16
# File 'models/user.rb', line 16

property :username,			String

Instance Method Details

- (Boolean) active

Returns User is active. False will disable and override all other perms

Returns:

  • (Boolean)

    User is active. False will disable and override all other perms



25
# File 'models/user.rb', line 25

property :active,			Boolean, :default => true

- (Boolean) active=(value)

Returns User is active. False will disable and override all other perms

Returns:

  • (Boolean)

    User is active. False will disable and override all other perms



25
# File 'models/user.rb', line 25

property :active,			Boolean, :default => true

- (Boolean) admin

Returns Perm bit. True if is a Vulnreport admin

Returns:

  • (Boolean)

    Perm bit. True if is a Vulnreport admin



30
# File 'models/user.rb', line 30

property :admin,			Boolean, :default => false

- (Boolean) admin=(value)

Returns Perm bit. True if is a Vulnreport admin

Returns:

  • (Boolean)

    Perm bit. True if is a Vulnreport admin



30
# File 'models/user.rb', line 30

property :admin,			Boolean, :default => false

- (Object) allocation



40
41
42
# File 'models/user.rb', line 40

def allocation
	return MonthlyAllocation.allocationForUser(self.id)
end

- (Integer) allocCoeff

Returns The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.

Returns:

  • (Integer)

    The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.



28
# File 'models/user.rb', line 28

property :allocCoeff,		Integer, :default => 200

- (Integer) allocCoeff=(value)

Returns The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.

Returns:

  • (Integer)

    The coefficient for allocation calculation. The number represents the total number of reviews the User would complete if tasked 100% for a year.



28
# File 'models/user.rb', line 28

property :allocCoeff,		Integer, :default => 200

- (Integer) approver_orgs

Returns IDs of Organizations who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Organizations who can approve for this user. Nil if none can.



38
# File 'models/user.rb', line 38

property :approver_orgs,	CommaSeparatedList

- (Integer) approver_orgs=(value)

Returns IDs of Organizations who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Organizations who can approve for this user. Nil if none can.



38
# File 'models/user.rb', line 38

property :approver_orgs,	CommaSeparatedList

- (Integer) approver_users

Returns IDs of Users who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Users who can approve for this user. Nil if none can.



37
# File 'models/user.rb', line 37

property :approver_users,	CommaSeparatedList

- (Integer) approver_users=(value)

Returns IDs of Users who can approve for this user. Nil if none can.

Returns:

  • (Integer)

    IDs of Users who can approve for this user. Nil if none can.



37
# File 'models/user.rb', line 37

property :approver_users,	CommaSeparatedList

- (Object) approvers



85
86
87
88
89
90
91
92
93
94
95
96
# File 'models/user.rb', line 85

def approvers
	if(self.requireApproval)
		return {:users => self.approver_users, :orgs => self.approver_orgs}
	else
		o = Organization.get(self.org)
		if(o.nil?)
			return {:users => nil, :orgs => nil}
		else
			return {:users => o.approver_users, :orgs => o.approver_orgs}
		end
	end
end

- (Boolean) canAuditMonitors

Returns Perm bit. True if allowed to audit monitor trigger logs

Returns:

  • (Boolean)

    Perm bit. True if allowed to audit monitor trigger logs



32
# File 'models/user.rb', line 32

property :canAuditMonitors,	Boolean, :default => false

- (Boolean) canAuditMonitors=(value)

Returns Perm bit. True if allowed to audit monitor trigger logs

Returns:

  • (Boolean)

    Perm bit. True if allowed to audit monitor trigger logs



32
# File 'models/user.rb', line 32

property :canAuditMonitors,	Boolean, :default => false

- (Boolean) canPassToCon

Returns Perm bit. True if allowed to pass an app to a contractor

Returns:

  • (Boolean)

    Perm bit. True if allowed to pass an app to a contractor



34
# File 'models/user.rb', line 34

property :canPassToCon,		Boolean, :default => false

- (Boolean) canPassToCon=(value)

Returns Perm bit. True if allowed to pass an app to a contractor

Returns:

  • (Boolean)

    Perm bit. True if allowed to pass an app to a contractor



34
# File 'models/user.rb', line 34

property :canPassToCon,		Boolean, :default => false

- (Boolean) contractor?

Returns:

  • (Boolean)


66
67
68
69
70
# File 'models/user.rb', line 66

def contractor?
	return false if(self.org == 0)
	o = Organization.get(self.org)
	return o.contractor
end

- (Integer) dashOverride

Returns ID of DashConfig User has chosen to override default dash for org with. -1 if no override.

Returns:

  • (Integer)

    ID of DashConfig User has chosen to override default dash for org with. -1 if no override.



26
# File 'models/user.rb', line 26

property :dashOverride,		Integer, :default => -1			#@return [Integer] ID of {DashConfig} User has chosen to override default dash for org with. -1 if no override.

- (Integer) dashOverride=(value)

Returns ID of DashConfig User has chosen to override default dash for org with. -1 if no override.

Returns:

  • (Integer)

    ID of DashConfig User has chosen to override default dash for org with. -1 if no override.



26
# File 'models/user.rb', line 26

property :dashOverride,		Integer, :default => -1			#@return [Integer] ID of {DashConfig} User has chosen to override default dash for org with. -1 if no override.

- (GEO) defaultGeo

Returns Default GEO for User

Returns:

  • (GEO)

    Default GEO for User



24
# File 'models/user.rb', line 24

property :defaultGeo,		Integer, :default => GEO::USA

- (GEO) defaultGeo=(value)

Returns Default GEO for User

Returns:

  • (GEO)

    Default GEO for User



24
# File 'models/user.rb', line 24

property :defaultGeo,		Integer, :default => GEO::USA

- (String) email

Returns User email address

Returns:

  • (String)

    User email address



20
# File 'models/user.rb', line 20

property :email,			String, :length => 500

- (String) email=(value)

Returns User email address

Returns:

  • (String)

    User email address



20
# File 'models/user.rb', line 20

property :email,			String, :length => 500

- (String) extEID

Returns User external EID if separate from SSO ID

Returns:

  • (String)

    User external EID if separate from SSO ID



19
# File 'models/user.rb', line 19

property :extEID,			String

- (String) extEID=(value)

Returns User external EID if separate from SSO ID

Returns:

  • (String)

    User external EID if separate from SSO ID



19
# File 'models/user.rb', line 19

property :extEID,			String

- (Integer) id

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/user.rb', line 13

property :id,				Serial

- (Integer) id=(value)

Returns Primary Key

Returns:

  • (Integer)

    Primary Key



13
# File 'models/user.rb', line 13

property :id,				Serial

- (String) initials

Returns User initials

Returns:

  • (String)

    User initials



22
# File 'models/user.rb', line 22

property :initials,			String

- (String) initials=(value)

Returns User initials

Returns:

  • (String)

    User initials



22
# File 'models/user.rb', line 22

property :initials,			String

- (Object) lastAllocation



44
45
46
# File 'models/user.rb', line 44

def lastAllocation
	return MonthlyAllocation.lastAllocationForUser(self.id)
end

- (String) name

Returns User name.

Returns:

  • (String)

    User name.



21
# File 'models/user.rb', line 21

property :name,				String, :length => 100

- (String) name=(value)

Returns User name.

Returns:

  • (String)

    User name.



21
# File 'models/user.rb', line 21

property :name,				String, :length => 100

- (Integer) org

Returns Organization ID of org the user belongs to. 0 = unverified

Returns:

  • (Integer)

    Organization ID of org the user belongs to. 0 = unverified



23
# File 'models/user.rb', line 23

property :org,				Integer

- (Integer) org=(value)

Returns Organization ID of org the user belongs to. 0 = unverified

Returns:

  • (Integer)

    Organization ID of org the user belongs to. 0 = unverified



23
# File 'models/user.rb', line 23

property :org,				Integer

- (Object) organization



53
54
55
56
# File 'models/user.rb', line 53

def organization
	return nil if(self.org == 0)
	return Organization.get(self.org)
end

- (Object) orgname



48
49
50
51
# File 'models/user.rb', line 48

def orgname
	return nil if(self.org == 0)
	return Organization.get(self.org).name
end

- (String) password

Returns Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it

Returns:

  • (String)

    Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it



17
# File 'models/user.rb', line 17

property :password,			BCryptHash

- (String) password=(value)

Returns Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it

Returns:

  • (String)

    Non-SSO password. If created via SSO, defaults to nil. If nil, user cannot login using it



17
# File 'models/user.rb', line 17

property :password,			BCryptHash

- (Boolean) provPassApprover

Returns Perm bit. True if allowed to approve provisional pass requests

Returns:

  • (Boolean)

    Perm bit. True if allowed to approve provisional pass requests



33
# File 'models/user.rb', line 33

property :provPassApprover,	Boolean, :default => false

- (Boolean) provPassApprover=(value)

Returns Perm bit. True if allowed to approve provisional pass requests

Returns:

  • (Boolean)

    Perm bit. True if allowed to approve provisional pass requests



33
# File 'models/user.rb', line 33

property :provPassApprover,	Boolean, :default => false

- (Boolean) reportsOnly

Returns Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.

Returns:

  • (Boolean)

    Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.



31
# File 'models/user.rb', line 31

property :reportsOnly,		Boolean, :default => false

- (Boolean) reportsOnly=(value)

Returns Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.

Returns:

  • (Boolean)

    Perm bit. If true, only allowed to view reports, nothing else. OVERRIDES other perms.



31
# File 'models/user.rb', line 31

property :reportsOnly,		Boolean, :default => false

- (Boolean) requireApproval

Returns Perm bit. True if this user needs approval to pass/fail a test

Returns:

  • (Boolean)

    Perm bit. True if this user needs approval to pass/fail a test



35
# File 'models/user.rb', line 35

property :requireApproval,	Boolean, :default => false

- (Boolean) requireApproval=(value)

Returns Perm bit. True if this user needs approval to pass/fail a test

Returns:

  • (Boolean)

    Perm bit. True if this user needs approval to pass/fail a test



35
# File 'models/user.rb', line 35

property :requireApproval,	Boolean, :default => false

- (Boolean) requiresApproval?

Returns:

  • (Boolean)


72
73
74
75
76
77
78
79
80
81
82
83
# File 'models/user.rb', line 72

def requiresApproval?
	if(self.requireApproval)
		return true
	else
		o = Organization.get(self.org)
		if(o.nil?)
			return false
		else
			return o.requireApproval
		end
	end
end

- (String) sso_id

Returns SSO-passed User EID 005xxx…

Returns:

  • (String)

    SSO-passed User EID 005xxx…



15
# File 'models/user.rb', line 15

property :sso_id,			String

- (String) sso_id=(value)

Returns SSO-passed User EID 005xxx…

Returns:

  • (String)

    SSO-passed User EID 005xxx…



15
# File 'models/user.rb', line 15

property :sso_id,			String

- (String) sso_user

Returns SSO-passed username

Returns:

  • (String)

    SSO-passed username



14
# File 'models/user.rb', line 14

property :sso_user,			String, :length => 500

- (String) sso_user=(value)

Returns SSO-passed username

Returns:

  • (String)

    SSO-passed username



14
# File 'models/user.rb', line 14

property :sso_user,			String, :length => 500

- (Boolean) useAllocation

Returns True if this user uses the MonthlyAllocation system

Returns:



27
# File 'models/user.rb', line 27

property :useAllocation,	Boolean, :default => false

- (Boolean) useAllocation=(value)

Returns True if this user uses the MonthlyAllocation system

Returns:



27
# File 'models/user.rb', line 27

property :useAllocation,	Boolean, :default => false

- (String) username

Returns Non-SSO username. If created via SSO, defaults to sso_user

Returns:

  • (String)

    Non-SSO username. If created via SSO, defaults to sso_user



16
# File 'models/user.rb', line 16

property :username,			String

- (String) username=(value)

Returns Non-SSO username. If created via SSO, defaults to sso_user

Returns:

  • (String)

    Non-SSO username. If created via SSO, defaults to sso_user



16
# File 'models/user.rb', line 16

property :username,			String

- (Boolean) verified?

Returns:

  • (Boolean)


58
59
60
61
62
63
64
# File 'models/user.rb', line 58

def verified?
	if(self.org == 0)
		return false
	else
		return true
	end
end