Welcome to Geeklog, Anonymous Sunday, December 22 2024 @ 08:04 pm EST

Geeklog Forums

Confusion over permissions and rights


anonymouse

Anonymous
If I have the following groups standard groups ie alll users and whatever custom groups have been created - in addtion to 'subscribed owners' and I want to restrict access to certain content then I put the user in the subscribed owners' group with relevant permissions. When the subcription is ended I simply delete them from the 'subscribed owners' group.

Im doing this thru the plugin hooks for plugin_create_user_ and plugin_login_user_. How to I tell if the user login is granted acess to this content because they are either root or admins to this group. so I dont remove their access due to no valid subscription record.

Im assuming its a combination of SEC_has rights and SEC_INGROUP but im not sure which group I should be checking and what rights in which order etc.

Thanks



 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
Your question isn't exactly clear but here's what I think you want.

Create a feature: subscriber.admin (or something more descriptive than "subscriber"Wink
Create two groups: "subscriptions" and "subscription admins"
Attach the subscriber.admin feature to the subscriotion admins group.
Add the subscription admins group to the subscriptions group.
Add the root group to the subscriber and subscriber admins group

When a sub expires, remove the user from "subscriptions". If the user is in subscription admins or root, he will still return "true" to calls of SEC_inGroup('subscribers'Wink because he's in a group in that group. If for some reason the admin loses his admin privilege (or loses root access), he will lose his subscription as well immediately unless he is also in the subscriber group personally.

That's how I'd do it.
 Quote

anonymouse

Anonymous
Thanks thats what I was trying to do.

Is there anyway to create this group structure when you run the install function for a plugin- The actual features part is in the universal plugin in code so I can accomplish that part.

but are there a api calls for create groups and assign groups etc? I have to admit im find this a tough learning curve.

Cheers.


 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
No such functions. Just run the SQL to add entries to directly to the database. Grab an existing plugin to see how they do the SQL. The tables in question are gl_features (for features), gl_groups (for groups), gl_group_assignments (for adding users and groups to another group) and gl_access (for adding features to a group).
 Quote

All times are EST. The time is now 08:04 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content