BrightSide Workbench Full Report + Source Code
org.turro.contacts.util.ContactAsUser Class Reference
Inheritance diagram for org.turro.contacts.util.ContactAsUser:
Collaboration diagram for org.turro.contacts.util.ContactAsUser:

Public Member Functions

String getName ()
 
String getId ()
 
boolean validate (String login, String password)
 
boolean validate (String key)
 
boolean validate2 (String password2)
 
boolean impersonate (String login)
 
boolean impersonateByEmail (String email)
 
void reload ()
 
boolean isThisUser (String id)
 
String getProperty (String key)
 
boolean isInRole (String role)
 
boolean hasAnyRoleKey (String role)
 
Map getByDescriptors (String value)
 
boolean hasRoleName (String role)
 
List getUsers ()
 
String createTmpKey (Date valid)
 
void setConstructor (IConstructor constructor)
 
- Public Member Functions inherited from org.turro.contacts.util.DefaultContact
 DefaultContact ()
 
 DefaultContact (Object object)
 
 DefaultContact (Contact contact)
 
Object loadById (String id)
 
Object loadByLogin (String login)
 
Object loadLogged (Application app)
 
Object getContact ()
 
void setContact (Object contact)
 
String getGlobalId ()
 
String getGrouping ()
 
String getDeepGrouping ()
 
String getLogin ()
 
String getFullName ()
 
String getTradeName ()
 
String getEmail ()
 
String getConnector (String id)
 
List< String > getConnectorList (String id)
 
List< IContactgetRelations (String id)
 
List< IContactgetRelations ()
 
IContact getBusiness ()
 
List< IContactgetBusinessList ()
 
List< IContactgetCoworkers ()
 
List< IContactgetCoworkers (IContact business)
 
boolean isInBusiness (IContact worker)
 
void setConnector (String id, String value)
 
void setName (String value)
 
void setPassword (String newValue, String repeatValue)
 
void applyChanges ()
 
boolean isValid ()
 
boolean checkPassword (String password)
 
boolean checkPassword2 (String password)
 
String getCommentValue (String key)
 
Object getObject (String key)
 
void setObject (String key, Serializable value)
 
boolean isWebUser ()
 
boolean isWebapp ()
 
boolean isUserMenu ()
 
boolean isDeactivated ()
 
List< String > getRoles ()
 
List< String > getSyndications ()
 
UserProfileMap getProfileMap ()
 
FlatPermissions getPermissions ()
 
void resetPermissions ()
 
IUser getAsUser ()
 
boolean acceptsLang (String lang)
 
List< IContactloadByPartialName (String name)
 
List< IContactloadByPartialName (String name, KeyValueMap kvm)
 
IContact loadByName (String name)
 
IContact loadByEmail (String email)
 
void setAttribute (String key, Object value)
 
Object getAttribute (String key)
 
List< IContactgetBySyndication (String syndication)
 
List< IContactgetByRole (String role)
 
List< IContactgetByGrouping (String grouping)
 
List< IContactgetByGrouping (List< String > groupings)
 
List< IContactgetCompanies ()
 
List< IContactgetCenters ()
 
List< IContactgetHHRR ()
 
List< IContactgetStudents ()
 
void startContactFromValues (KeyValueMap values)
 
void syndicate (String syndicationName, boolean syndicate)
 
String getFace ()
 
IProfile getProfile ()
 
boolean isAdmin ()
 
boolean isUser ()
 
boolean isCompany ()
 
boolean isCenter ()
 
boolean isInternal ()
 
boolean isWorker ()
 
boolean isStudent ()
 
boolean isResponsible ()
 
boolean isHHRR ()
 
boolean isWorker (IContact business)
 
boolean isStudent (IContact business)
 
boolean isResponsible (IContact business)
 
boolean isHHRR (IContact business)
 
boolean isInNetworking ()
 
boolean isInPremiumNetworking ()
 
String getLangTranslator ()
 
boolean isActor (String actor)
 
boolean isActor (Object entity, String actor)
 
IContact getLogged ()
 
int hashCode ()
 
boolean equals (Object obj)
 
int compareTo (IContact o)
 
- Public Member Functions inherited from org.turro.plugin.contacts.IContact
void setApplication (Application app)
 
- Public Member Functions inherited from org.turro.elephant.security.IUser
boolean isValid ()
 
boolean equals (Object obj)
 

Protected Attributes

IConstructor constructor
 
boolean superUser = false
 
- Protected Attributes inherited from org.turro.contacts.util.DefaultContact
Contact contact = null
 

Additional Inherited Members

- Static Public Member Functions inherited from org.turro.contacts.util.DefaultContact
static String fullName (String contactId)
 
- Static Public Attributes inherited from org.turro.elephant.security.IUser
static final String CONNECTOR_EMAIL = "Email"
 
static final String CONNECTOR_TRADE = "TradeName"
 
static final String CONNECTOR_FISCAL = "FiscalName"
 
static final String CONNECTOR_EMAIL_LOGIN = "EmailLogin"
 
static final String ADDRESS_FISCAL = "Fiscal"
 
static final String LOGGED_USER = "xp_user"
 
static final String INTERNAL_SIGNIN = "InternalSignIn"
 

Detailed Description

Author
Lluis Turró Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 36 of file ContactAsUser.java.

Member Function Documentation

◆ createTmpKey()

String org.turro.contacts.util.ContactAsUser.createTmpKey ( Date  valid)

Implements org.turro.elephant.security.IUser.

Definition at line 176 of file ContactAsUser.java.

176  {
177  throw new UnsupportedOperationException("Temporal keys no longer supported.");
178  }

◆ getByDescriptors()

Map org.turro.contacts.util.ContactAsUser.getByDescriptors ( String  value)
Returns
A map of users.

Implements org.turro.elephant.security.IUser.

Definition at line 160 of file ContactAsUser.java.

160  {
161  throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
162  }

◆ getId()

String org.turro.contacts.util.ContactAsUser.getId ( )

Reimplemented from org.turro.contacts.util.DefaultContact.

Definition at line 49 of file ContactAsUser.java.

49  {
50  String id = super.getId();
51  return Strings.isBlank(id) ? "#" : id;
52  }
Here is the caller graph for this function:

◆ getName()

String org.turro.contacts.util.ContactAsUser.getName ( )

Reimplemented from org.turro.contacts.util.DefaultContact.

Definition at line 43 of file ContactAsUser.java.

43  {
44  String name = super.getName();
45  return Strings.isBlank(name) ? "#" : name;
46  }

◆ getProperty()

String org.turro.contacts.util.ContactAsUser.getProperty ( String  key)
Parameters
keyAttribute's key.
Returns
Attribute's value.

Implements org.turro.elephant.security.IUser.

Definition at line 135 of file ContactAsUser.java.

135  {
136  return getConnector(key);
137  }
Here is the call graph for this function:

◆ getUsers()

List org.turro.contacts.util.ContactAsUser.getUsers ( )

Implements org.turro.elephant.security.IUser.

Definition at line 171 of file ContactAsUser.java.

171  {
172  throw new UnsupportedOperationException("Not supported yet.");
173  }

◆ hasAnyRoleKey()

boolean org.turro.contacts.util.ContactAsUser.hasAnyRoleKey ( String  role)

Implements org.turro.elephant.security.IUser.

Definition at line 147 of file ContactAsUser.java.

147  {
148  if(superUser) return true;
149  return getPermissions().anyKeyMath(Strings.csvToList(role));
150 // String[] value = role.split(" *, *");
151 // for(String s : value) {
152 // if(upm.containsKey(s)) {
153 // return true;
154 // }
155 // }
156 // return false;
157  }
boolean anyKeyMath(List< String > roles)
Here is the call graph for this function:

◆ hasRoleName()

boolean org.turro.contacts.util.ContactAsUser.hasRoleName ( String  role)

Implements org.turro.elephant.security.IUser.

Definition at line 165 of file ContactAsUser.java.

165  {
166  if(superUser) return true;
167  return getRoles().contains(role);
168  }
Here is the call graph for this function:

◆ impersonate()

boolean org.turro.contacts.util.ContactAsUser.impersonate ( String  login)
Parameters
loginUser login.
Returns
True if user was impersonated.

Implements org.turro.elephant.security.IUser.

Definition at line 97 of file ContactAsUser.java.

97  {
98  IContact ic;
99  if(login.contains("@")) {
100  ic = loadByEmail(login);
101  if(ic != null) {
102  contact = (Contact) ic.getContact();
103  }
104  } else {
105  loadById(login);
106  }
107  if(isValid()) {
108  //upm = getProfileMap();
110  return true;
111  }
112  return false;
113  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ impersonateByEmail()

boolean org.turro.contacts.util.ContactAsUser.impersonateByEmail ( String  email)

Implements org.turro.elephant.security.IUser.

Definition at line 116 of file ContactAsUser.java.

116  {
117  return impersonate(email);
118  }
Here is the call graph for this function:

◆ isInRole()

boolean org.turro.contacts.util.ContactAsUser.isInRole ( String  role)

Usually this method should take this form:

 if(user.isInRole("page:edit")) {
   // edit page
 }
Parameters
roleRole to check.
Returns
True if user is in role.

Implements org.turro.elephant.security.IUser.

Definition at line 140 of file ContactAsUser.java.

140  {
141  if(superUser) return true;
142  //return upm.isInRole(role);
143  return getPermissions().isInRole(role);
144  }
Here is the call graph for this function:

◆ isThisUser()

boolean org.turro.contacts.util.ContactAsUser.isThisUser ( String  id)

Implements org.turro.elephant.security.IUser.

Definition at line 130 of file ContactAsUser.java.

130  {
131  return !Strings.isBlank(id) && (id.equals(contact.getId()) || id.equals(contact.getLogin()));
132  }
Here is the call graph for this function:

◆ reload()

void org.turro.contacts.util.ContactAsUser.reload ( )

Implements org.turro.elephant.security.IUser.

Definition at line 121 of file ContactAsUser.java.

121  {
122  loadById(getId());
123  if(isValid()) {
124  //upm = getProfileMap();
126  }
127  }
Here is the call graph for this function:

◆ setConstructor()

void org.turro.contacts.util.ContactAsUser.setConstructor ( IConstructor  constructor)

Implements org.turro.elephant.security.IUser.

Definition at line 181 of file ContactAsUser.java.

181  {
182  this.constructor = constructor;
183  }

◆ validate() [1/2]

boolean org.turro.contacts.util.ContactAsUser.validate ( String  key)
Parameters
keyTemporal key for validation.
Returns
True if user was impersonated.

Implements org.turro.elephant.security.IUser.

Definition at line 87 of file ContactAsUser.java.

87  {
88  throw new UnsupportedOperationException("Temporal keys no longer supported.");
89  }

◆ validate() [2/2]

boolean org.turro.contacts.util.ContactAsUser.validate ( String  login,
String  password 
)
Parameters
loginUser login.
passwordUser password.
Returns
True if user was validated.

Implements org.turro.elephant.security.IUser.

Definition at line 55 of file ContactAsUser.java.

55  {
56  login = login.trim();
57  password = password.trim();
58  if(Strings.isBlank(login) || Strings.isBlank(password)) return false;
59  Map<String, Object> args = new HashMap<>();
60  args.put("login", login);
61  args.put("password", password);
62  args = Plugins.execute("SuperUser", args);
63  if(Boolean.TRUE.equals(args.get("su"))) {
64  superUser = true;
65  return true;
66  }
67  IContact ic;
68  if(login.contains("@")) {
69  ic = loadByEmail(login);
70  if(ic != null) {
71  contact = (Contact) ic.getContact();
72  }
73 // } else {
74 // loadByLogin(login);
75  }
76  if(isValid() && checkPassword(password)) {
77  //upm = getProfileMap();
79  return true;
80  } else {
81  contact = null;
82  }
83  return false;
84  }
boolean checkPassword(String password)
Here is the call graph for this function:

◆ validate2()

boolean org.turro.contacts.util.ContactAsUser.validate2 ( String  password2)
Parameters
password2User password2.
Returns
True if user validates password2.

Implements org.turro.elephant.security.IUser.

Definition at line 92 of file ContactAsUser.java.

92  {
93  return checkPassword(password2);
94  }
Here is the call graph for this function:

Member Data Documentation

◆ constructor

IConstructor org.turro.contacts.util.ContactAsUser.constructor
protected

Definition at line 38 of file ContactAsUser.java.

◆ superUser

boolean org.turro.contacts.util.ContactAsUser.superUser = false
protected

Definition at line 39 of file ContactAsUser.java.


The documentation for this class was generated from the following file: