Using g2 permission implementation in own website ?

ie

Joined: 2005-08-20
Posts: 4
Posted: Sat, 2005-08-20 15:06

Hi,

I'm really fond of the user/group handling in g2. Is it possible to use the permission system on my own website, so I can embed g2 into this site ?

I would like to combine the ease-of-use between g2 and movable type, so only registered g2 users can view my blog. Is this possible with a quick php hack ?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-08-20 15:52

noone tried this before, so we haven't thought of how to do that before.
we're quite happy with our permission system, but not yet with the user interface for it.

however, how could this work?
there are a number of things involved.
- authentication: do you want people to login in g2 or in mt?
- you'll have to hack mt such that it runs a tiny 2 script on each request that checks in g2 if the user is a registered user.

it'd suggest the following:
1. user logs in in G2 -> user has g2 session, you'll need to change the g2 cookie path in site admin.
2. not sure how mt works. is there a single file like index.php or like G2's main.php? then you could just add the g2 code in this file.

// load g2
require_once('./gallery2/embed.php');
GalleryEmbed::init();
// do the permission check
...see: modules/core/classes/GalleryCoreApi.class
// first get the id of the registered user group
list ($ret, $groupId) =
GalleryCoreApi::getPluginParameter('module', 'core', 'id.allUserGroup');

function isUserInGroup($gallery->getActiveUserId, $groupId) {

// either continue with the request or redirect to a g2 login page
...

this approach requires the user to accept cookies (most do), else it would get a little more involving

 
ie

Joined: 2005-08-20
Posts: 4
Posted: Sat, 2005-08-20 18:11

Thank you for this quick reply - I will try to embed some php code in my MT templates. I am not trying to integrate the MT application as such, only the generated html files. Sorry for not being clear on that, and thanks for the pointers !