drupal 6 authenticated user - drupal-6

In drupal 6 there is two by default role anonymous user and authenticated user.by mistake remove authenticated user.it create many problem for checking permission of authenticated user
so how to get authenticated user role.or(rollback that operation).

Fire insert query in phpmyadmin
INSERT INTO tablename.role (rid, name) VALUES ('2', 'authenticated user')

Instead of table name, use database name. Fire insert query in phpMmyAdmin like this:
INSERT INTO database name.role (rid, name) VALUES ('2', 'authenticated user')

Related

set calculated property on model only once

im using python3 + django, and i have
a model of User with few fields
an admin page where all the users are presented
a form page where a single user is presented and can be updated
an external API with 2 endpoints:
GET /api/users/name (get all names for all the users)
GET /api/users/:id/name (get name for user by id)
i want to add a name property to be presented on admin page (as a column) and on a form page (read-only, not changeable)
how can i add this "calculated" property without calling an api more than needed?
it is normal function, you should create new method in ModelAdminand you can use result of this method in render.
more here:
https://docs.djangoproject.com/en/4.0/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields
if you want to get username as readonly in list and in form, add this method in list_display and in field or fieldsets Modeladmin options.
You don't need to use other api, if you has already users list.

UserEmailAddressException while login in Liferay

I'm trying to log-in in the login page of Liferay but It's showing UserEmailAddressException while calling authenticateByEmailAddress method in LoginUtil class of portal-Impl.jar.
I'm also getting the following warning.
No Group exists with the key {companyId=10113, classNameId=10039, classPK=10116} liferay
Here classPk is UserId but everytime it's taking the same value of classPk i.e 10116 instead It should take the logged in person's UserId from USER_ table.
I tried to find the implementation(code) of authenticateByEmailAddress method in portal-Impl.jar but couldn't find it. I failed to find how it's getting classPk=10116 that's where problem lies.
String authResult = UserLocalServiceUtil.authenticateByEmailAddress(company.getCompanyId(), login, password, headerMap, parameterMap);
When all the valid parameters are passed in authenticateByEmailAddress method. It should return 1. i.e successful authentication but UserEmailAddressException exception is being thrown.
"No Group exists with the key" error will occur when there is no corresponding entry in the group_ table .
in Latest versions of liferay, after successful login, an entry will created in the group_ table.
in this case, it may be corrupted/deleted. please check that way.
Thanks

Issue while inserting the user in liferay

I have created a form which has basic user details and on clinking of the Save button I am inserting the user details in the "USER_" table by calling the UserLocalServiceUtil.addUser(....). Now the user is creating with out any issue. But I am not able to see some form field parameters in UserLocalServiceUtil.addUser(....) method like (Title, Gender and Date Of Birth). Now how can I save this values. Please give me some suggestions that how can I insert the following fields (Title, Gender and Date Of Birth) at the time of user creation.
Liferay uses com.liferay.portal.model.Contact entity to store the contact information.
Use com.liferay.portal.service.ContactLocalServiceUtil.addContact method to create the contact. Significant parametres:
userId - Id of the user that is creating the contact. You can use PortalUtil.getUser method to get the current user from a request.
className - "com.liferay.portal.model.User".
classPK - Id of the new user that the contact is created for.

Foreign key search fails in Rails 3

I am coding a small community in Rails 3 and I got two tables, Profiles and Contacts. When a user adds a friendship with another user it is saved in a table called Contacts which holds two columns; profile_id and friend_id.
Profile_id: This is where the users ID is saved
Friend_id: This is where the other users ID is saved
If a another user adds the user as a friend I want it to show up on the users home screen so that he can add the other user as well, but I only want it to show up if the user does not already have the other user as a friend.
I have tried the code below but it doesn't seem to work as I want it to.
#connections = Contact.where(["friend_id = ?", params[:profile_id]])
#notfriends = #connections.find_all {|profile| Contact.where(["profile_id = ? AND friend_id = ?", profile.friend_id, params[:profile_id]])}
Any ideas what is wrong? Is this the correct syntax?
UPDATE
So what I am looking to achieve is:
Get all contacts where the user is set as friend (friend_id).
Then I will would like to only get the contacts from the above query which the user does not already have as a friend (profile_id).
In line 2 of your code params[:profile_id] and profile.friend_id are necessary the same... since in your first query you search for entry where friend_id == params[:profile_id].

Two forms on the same page drupal

I have a database of clients. Before entering a new client, I want to make sure that that client is not already in the database. So I want to put a search form at the top of my page to search by client number, and client name. Further down the page, I'll have another form to enter and submit the client's information. Would this be the best way to go about something like this? How would you approach this? i'm using drupal 6.
It is better that when the user is inserting a new customer name, an autocomplete shows the names matching the characters inserted by the user; if the user wrote "Mic", and in the database there is a customer with the name "Michael Greenpeace", the autocomplete will show "Michael Greenpeace", and the user will understand there is already a record for that customer.
Even without the autocomplete (which would help the user to understand if the data for the customer has been already inserted in the database, and continue with the next customer), a user that inserted the name of an existing customer should see the existing data; this would help the user to avoid rewriting data that are already updated (customer information need to be updated, sometimes, and not only inserted).

Resources