Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do you plan to support Grocery Crud Enterprise Edition? #13

Open
yusuf-mutlu opened this issue Apr 8, 2018 · 36 comments
Open

Do you plan to support Grocery Crud Enterprise Edition? #13

yusuf-mutlu opened this issue Apr 8, 2018 · 36 comments

Comments

@yusuf-mutlu
Copy link

Hello,

I like this Login-GroceryCrud job. I have used this with grocery crud community edition and helped me a lot. Do you plan to support also Enterprise Edition? It would be amazing if you could. :)

@portapipe
Copy link
Owner

Thanks @RudyardKipling :)
This plugin is optimized for GroceryCrud but it's basically matchable with any project!
Give it a try and let me know, but I think I'll add the Enterprise Edition support.

@yusuf-mutlu
Copy link
Author

I have been trying to manage permissions for Enterprise Edition but i couldn't know how to set the library for Enterprise Edition.

image

@yusuf-mutlu
Copy link
Author

yusuf-mutlu commented Apr 8, 2018

I think now i have some reasonable errors after setting up the library properly. :)

Reasonable Erors :)

@yusuf-mutlu
Copy link
Author

I have been trying to integrate Grocery Crud Enterprise with Codeigniter framework by the way.
This Login-GroceryCrud integration really needs a grocery crud expert :)

@portapipe
Copy link
Owner

@RudyardKipling 403 on the screenshots you've sent for reasonable errors...
I can help you integrate it, just post the errors and let's try...

@yusuf-mutlu
Copy link
Author

yusuf-mutlu commented Apr 8, 2018

I am trying tests for grocery crud standart example database.
When checking a table's permissions for a user i am having this error on Login_model.php on line 125

"Type: PDOException
Message: You cannot serialize or unserialize PDO instances"

image

My code for test is:
image

How can i solve this?

I solved this, i had to check crud before rendering. this is ok. :)

@yusuf-mutlu
Copy link
Author

1.) Now, i dont get errors for checking my crud with Login_model.php. But although i set edit, add and delete permissions for my crud, i cannot see edit, add, delete options on my crud.

Here is my code:
image

And my output crud:
image

2.) I can render manage_permissions without errors:
image

But when i try to save my permissions i am having some ajax errors:
image

@yusuf-mutlu
Copy link
Author

yusuf-mutlu commented Apr 8, 2018

For 1st matter above i mentioned, i recognised something.

The problem is about check function in Login_model.php. Table name cannot be unserialized correctly. Because of this, every condition about crud returns false and it behaves like there is no permission.

If you can tell me how to debug crud variable, i can find a way.

image

@portapipe
Copy link
Owner

How many odds issues...
I had to ask you what you need to do, then I can suggest stuff :P
I thought you had to make a simple login but if you need some advanced stuff let me know which ones

@yusuf-mutlu
Copy link
Author

I know the issues i wrote looks like a mess :s I just want to make Login-GroceryCrud work for GroceryCrud EnterPrise like it works perfect for GroceryCrud Community edition. The simple usage is enough for me.

If i solve the 2 matters i wrote above, then everything will be fine.
I really like Grocery Crud and your Login system, i have become fan of you and John by time. :))

Thanks for your kindness. :)

@portapipe
Copy link
Owner

Oh thanks man! I think @scoumbourdis will be happy for that.
I think that I’ve saw the serialize issue once... I did a simple change that I don’t remember atm, it was tricky but few lines indeed... I’ll check that for you but if this is the only problem I think is fully compatible with the enterprise edition! 00:25 here, today I’m gonna check that for you :)

@scoumbourdis
Copy link

Hello guys,

I would love to start using it in Grocery CRUD Enterprise and have an official example at the website. But as @portapipe already knows my time is very very limited and already promised him something that I still can't find the time to do. The good news is that everything is within a backlog so they will not be forgotten. The bad news is that my backlog is huge 😄

Currently working to finish the bootstrapV4 theme for grocery CRUD Enterprise that will be available probably this week (I will announce it in twitter) and at the same time I did finish creating a YouTube video (Which PHP Framework is best for you? 2018 update) and all of these on my public holidays (Orthodox Easter) but I like to work on these stuff so I am not regretting it :)

@portapipe
Copy link
Owner

Well that’s cool enough, built directly in the enterprise edition in the next future!
For now let me go to work so I can take a look at the changes I did for that issue...
Don’t worry John, I have a though moment at work too, plus new clients with jobs... but that jobs probably will need some extra stuff so... you know what I’m talking about ;)

@yusuf-mutlu
Copy link
Author

@scoumbourdis If you could make an official example about Login-GroceryCrud it would be wonderful.
An easy to use awesome crud(Grocery Crud) and an easy to use awesome login system(Login-GroceryCrud), what can a developer want more for starting a project in lightning speed. :)
Keep up the great work. My best wishes with who contributes to these projects. :)

@portapipe
Copy link
Owner

portapipe commented Apr 9, 2018

@RudyardKipling comment the first $state declaration and change the second one as following:

                /*
		$state = unserialize(
			preg_replace(
				'/^O:\d+:"[^"]++"/', 
				'O:'.strlen("portapipe").':"portapipe"',
				serialize($crud)
			)
		);
		*/
		//$state = json_encode((array)$state);
		$state = json_encode((array)$crud);
		$state2 = strpos($state,'basic_db_table":"');
		$state = str_replace('basic_db_tab.....................

and let me know if it works.

@yusuf-mutlu
Copy link
Author

@portapipe I have figured out that, there is no need to change unserialize or json_encode code. If I replace 'basic_db_table' with 'dbTableName' everything works fine.

//$state2 = strpos($state,'basic_db_table":"');
//$state = str_replace('basic_db_table":"','',substr($state, $state2));

$state2 = strpos($state,'dbTableName":"');
$state = str_replace('dbTableName":"','',substr($state, $state2));

1st problem i mentioned above is ok now. :)

Now i am trying to save manage_persmissions. I get some javascript error. If i solve this, too. I will be very happy. :))

@yusuf-mutlu
Copy link
Author

For the 2nd problem i have, it is because of difference between EnterPrise and Community Edition's callbackBeforeUpdate and callbackBeforeInsert functions. I have to rewrite Login-GroceryCrud's some functions:

image

@portapipe
Copy link
Owner

@RudyardKipling great work!

@scoumbourdis
Copy link

Hey @RudyardKipling great work,

Can you please copy the example that you did use at https://gist.github.com/ so it will be easier for me to create examples for Grocery CRUD Enterprise?

Please just share your controller only as this is enough for people to understand.

Regards
Johnny

@yusuf-mutlu
Copy link
Author

@scoumbourdis I am using codeigniter framework. Theese are the files i edited for Enterprise Edition.

You can reach Login.php's edited version from Login-GroceryCrud:
https://gist.github.com/RudyardKipling/9b7ef9dc8cfbfdbcbc3fc335de223fb1

Examples controller:
https://gist.github.com/RudyardKipling/695358b2f7e8e4820c88b614b167ad58

Login_model.php from Login-Grocery Crud.
https://gist.github.com/RudyardKipling/800f3d54e3c52b98b0be464bb4bd6229

I want to make something clear. I couldn't make work manage_permissions function from Login.php. I still need help for this. :)

@yusuf-mutlu
Copy link
Author

I couldn't make "manage_permissions" functions work with GroceryCrud Enterprise edition.
If it is solved, Login-GroceryCrud system will be fully compitable with GroceryCrud Enterprise edition.

I need some help plz. :/

image

@portapipe
Copy link
Owner

@RudyardKipling the error shown below tells nothing. You have to look inside the page you're calling and that throws error. A better debug can show the issue. I think is something related edited function names like "unset_edit/add/delete" or stuff like that.
I'm not using Enterprise ATM so I can't help as I want but I'm here if you need more help.

@yusuf-mutlu
Copy link
Author

yusuf-mutlu commented Apr 10, 2018

For the "manage_permissions" issue, after hours i have decided to use CommunityEdition for only "manage_permissions" function. Thats not a good way but somehow it is a solution. :D I will be using both Community and Enterprise Edition in my projects same time depends on the situation. Thanks for your kindness and helps.

@portapipe
Copy link
Owner

I just have to take a look on how the Enterprise Edition do stuff but with a bit of effort you could figure out by yourself :)

@nyala1
Copy link

nyala1 commented Aug 22, 2018

Did you guys ever come up with a working login system for stand-alone Enterprise Edition or CodeIgniter package?

@portapipe
Copy link
Owner

Hi nyala1.
This Login system work with Codeigniter alone.
The permission grid is the only one that require GroceryCrud at the moment.
I’m secretly planning on create an enhanced version of it, but it will take some time and I’m having a high work requests since a year, but I want to revolutionize the permission management 🙂

@nyala1
Copy link

nyala1 commented Aug 26, 2018

Hi, and thanks for your unexpectedly quick response. I'm happy that this projects till has your attention as it could be really useful. :)

The delay in my response is because I wanted to get it up and running before responding and I am stuck. I'm sure that I am doing something simple wrong as I have followed your instructions but I get a successful login message, "HI admin! You are Logged IN!" but then I get a model with, for starters, a parse error:"


We can't process the response of the server. This is all we know about it:
Summary:parsererror
Error:SyntaxError: Unexpected token H in JSON at position 0


I've tried everything I can think of but it must be outside my abilities. Any help I can get from you would be greatly appreciated. I just need to be pointed in the right direction:)

If you give me an email address I can send you a link to my sandbox so you can see for yourself.

Regards,

Marv

@portapipe
Copy link
Owner

portapipe commented Aug 26, 2018

Hi @nyala1 ,
I think this is not a GCLogin related issue... I can suggest you to make a step-by-step code debug (like add a echo 'from here it's all fine';die; line by line on the page that throws that error) then came back here if it still happen.

@nyala1
Copy link

nyala1 commented Aug 27, 2018

Hi, I've worked on this for some time and cannot figure it out. I can tell you however that if I add the GCLogin code to the function I want to be protected it fails and if I don't add it everything works so seems it is at least related to your code. For example the following throws the error but if I remove your code it works as expected. I'm at a loss unless I'm adding your code incorrectly.?

public function requests()
{
$this->load->model("login_model");

if($this->login_model->isLogged()){
$name = $this->login_model->name();
echo "HI $name! You are Logged IN!";
}else{
redirect("/login");
}_

		
    $crud = $this->_getGroceryCrudEnterprise();
    $crud->setTable('quotes');
    $crud->setSubject('Trip Request', 'Open Trip requests');
    $crud->columns(['id','qdate','origin','destination','date','pax','actype']);

		if ($crud->getState() === 'Initial') {
    $origin_dropdown = [];
    $this->db->distinct();
    $this->db->select('origin');
    $this->db->order_by('origin');
    foreach ($this->db->get('quotes')->result() as $row)`

@portapipe
Copy link
Owner

The code seems fine...
The error says that there is an unexpected H and the only one that I see is in the echo message... can you try to change it and see what’s going on? Try a line by line debug on that few lines...

@nyala1
Copy link

nyala1 commented Aug 27, 2018

I have tried the line by line debugging and we're good all the way through the penultimate line where we render it. If you look at the code below and look at where I have echo "from here it's all fine";die; ----- It's when I move the debug code below the last line "$this->_example_output($output);" that we get the error.

`public function requests()
{
$this->load->model("login_model");

if($this->login_model->isLogged()){
$name = $this->login_model->name();
echo "HI $name! You are Logged IN!";
}else{
redirect("/login");
}

$crud = $this->_getGroceryCrudEnterprise();
		
$crud->setTable('quotes');
$crud->setSubject('Trip Request', 'Open Trip requests');
$crud->columns(['id','qdate','origin','destination','date','pax','actype']);

	if ($crud->getState() === 'Initial') {
$origin_dropdown = [];
$this->db->distinct();
$this->db->select('origin');
$this->db->order_by('origin');
		
foreach ($this->db->get('quotes')->result() as $row) {
    $origin_dropdown[$row->origin] = $row->origin;
}
	
$crud->fieldType('origin', 'dropdown_search', $origin_dropdown);

}
if ($crud->getState() === 'Initial') {
$destination_dropdown = [];
$this->db->distinct();
$this->db->select('destination');
$this->db->order_by('destination');
foreach ($this->db->get('quotes')->result() as $row) {
$destination_dropdown[$row->destination] = $row->destination;
}
$crud->fieldType('destination', 'dropdown_search', $destination_dropdown);
}

$output = $crud->render();
	echo "from here it's all fine";die;//This is as far as I can get error free

$this->_example_output($output);

//if I move the debug code here we get the error.
}
`


//If you send me an email address I will send you a link to the sandbox

@nyala1
Copy link

nyala1 commented Aug 27, 2018

A couple additional thoughts...

Remember that this is GC Enterprise not community (although I can’t see where that would matter)

All the existing code before adding GCLogin code was personally “Johnney Approved.” So I think it’s good.

Given that the errors only present themselves after the output statement I am really confused. The error seems to be because of something returned in the Json return. Can’t inagine what that could have to do with your code but nonetheless if I remove your code it all works fine.

Is there something so should have in your config file that could be wrong?

Thanks for your continued help!!

@portapipe
Copy link
Owner

I don't think is a PHP version issue, so I think you can put some "return;" or "die;" in my library and model, just to make a line by line debug of the GCLogin library too. This is what I'd do.

@yusuf-mutlu
Copy link
Author

yusuf-mutlu commented Sep 18, 2018

Hi, I am writing for people who has concerns about Grocery Crud Enterprise working with Login-Grocery Crud.
I am using theese two for months, they are really very very good together. With help of theese awesome 2 libraries, I am able to finish a project in a day that can be finished in a week.

If you want to use Login-Grocery Crud with Enterprise version, you just need to change check function in Login_model.php. I have the sample that working well with Enterprise:
https://gist.github.com/RudyardKipling/2c3e1a9f3b638f75c95ec0542018b542

Only on Manage Permissions screen, i am using community edition and everything is fine.

@nyala1
Copy link

nyala1 commented Sep 19, 2018 via email

@harshalone
Copy link

I have the same problem : https://www.bylde.com/admin/users/test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants