useradmin problem adding user (Call to undefined method Auth_ORM::register()) - kohana-3

When I try to add a user this is the error I get:
ErrorException [ Fatal Error ]: Call to undefined method Auth_ORM::register()
It does not make any sense. I added ORM and AUTH... For some reason it does not work.

I guess you are referring to the useradmin module of mixu (https://github.com/mixu/useradmin) for the Kohana php framework.
This problem goes away if you add the module BEFORE the auth and orm modules in bootstrap.php

There's no such thing as a register method in Auth. You'll have to enter the details into the database using ORM. The User model hashes the password automatically.
https://github.com/kohana/orm/blob/3.1%2Fmaster/classes/model/auth/user.php#L53

Related

Is createStratergy a function?

passport.use(User.createStrategy());
^
TypeError: User.createStrategy is not a function
I dont know like docs has it repo has it .. But I get it even after installing latest packages of passport and imported them .
Are you exporting createStrategy function from User class? In general passport.use will have two parameters(name,strategy). This strategy will be based on the idp you are using.

Mean.io graphql don't allow me to insert new record in a new schema

I am just a newbie in mean.io . I want to build an event module just like the post which can be found the default module when you make an installation. I have taken everything from the post and renamed it as event. Now when I am trying to insert a new record in the event schema its showing an error like
there was an error sending the query Error: GraphQL error: Unknown type "EventInput". Did you mean "PostInput"?
GraphQL error: Cannot query field "addEvent" on type "Mutation". Did you mean "addPost"?
So can someone tell me what I am doing wrong here? Any suggestion or help will be really appreciable.
The problem is with innograph.
The addPost is coming from this npm module and not the actual /server/ changes that you have made.
innograph is initialised in express.js
The solution is to copy the innograph code into you application. Make all the changes and actually remove innograph from package.json.
If its too much just remove innograph, graphql, apollo packages and then simply use express.js that is also pre-built into mean.io.
The second step requires changes to be made into /server/ folder. I had to do some debugging to actually make it work.

Authentication error when connecting to specific mongodb database

I am currently using nodejs with mongodb native driver. So my mongodb has been set with admin auth with root role, so I can log in using robomongo or command line just fine. So back to my project, I m able to connect to mongodb just fine if i set my connection string:
mongodb://admin:password#localhost:27017/
However, if I use this connection string:
mongodb://admin:password#localhost:27017/specificdb
It return as:
MongoError: Authentication failed
I am able to access the db using command and robomongo, is there anything I can do? I have added the admin user under the db, but still got the same problem.
The database you specify is the one you authenticate on. If the user is not known/has no roles for that database it cannot authenticate to it.
https://docs.mongodb.com/manual/reference/connection-string/
What you can do is either create the (or a new) user for that database or use an authentication database parameter.
this worked for me :
first solution on connection :
mongoose.connect('mongodb://....', {
// add this line
authSource:"admin",
....
})
or second solution add to the uri "?authSource=admin" :
mongodb://user:password#host/yourDB?authSource=admin
** to note that I am using mongoose and this is the documentation specefic statement and the url :
authSource - The database to use when authenticating with user and pass. In MongoDB, users are scoped to a database. If you are getting an unexpected login failure, you may need to set this option.
https://mongoosejs.com/docs/connections.html#options

JHipster first application

I’m a complete JHipster beginner and I want to create my first own JHipster application, but I got a problem that I’m not able to solve.
Firstly, I generated my app with following settings:
-Monolithic application
then I chose a base name and a default Java package of my app and HTTP Session Authentication.
Later, I chose following:
-SQL, MYSQL, MYSQL, Yes, with ehcache, Gradle, CSS preprocessor : Yes, Internationalization: Yes, Testing framework: Gatling
And to that moment everything looked fine , then I wanted to create my entity as follows:
Yo jhipster:entity activitylist
and I added three fields:
-activityname (String), acitivitydate (LocalDate) and rating (Integer) and then I added relationship with entity user, type: many to one.
Afterwards
I used yo jhipster:entity user and I added following fields: login(String), name(String), surname(String) and added relationship one to many with field user.
However, everytime when I tried to run it with docker I got compile Java Failure and following warnings:
warning: Unmapped target property: "authorities".
UserDTO userToUserDTO(User user);
error: Unknown property "password" in return type.
User userDTOToUser(UserDTO userDTO);
I would appreciate any help.
The problem with your app is the name of your entity: user.
You need to change the name of this entity because when You name it as following You create a new Java class : User, however JHipster has its own built-in User Java class which is located in src/main/java/domain folder.
This class has its own getter, setter methods and mapper which operation is affected when your entity „user" is created.
You can notice this fact in Your warnings when compiler informs You that it encountered unknown properties in Your return type in User userDTOToUser. I would strongly recommend You changing name of the user entity and everything else should work fine.

Kohana Database Configuration System

I am trying to get the database configuration functionality working with kohana 3.2. I want to attach the Config_Database as source:
Kohana::$config->attach(new Config_Database, False);
Described here: http://kohanaframework.org/3.2/guide/kohana/config
I attach the new source after loading the modules (so the database module is loaded before attaching the source). But when I have attached the new source it seems as if kohana does not want to load any controller using the Auth module with ORM driver. Then the browser loads and loads but only a white page appears. All other controller, not using the ORM or Auth module, function properly.
Can anyone give a short explanation how to use the Config_Database functionality, or give a alternative.
Update ORM module to 3.2/develop

Resources