Author Topic: Permissions Mask?  (Read 6234 times)

0 Members and 1 Guest are viewing this topic.

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Permissions Mask?
« on: May 11, 2007, 07:04:53 AM »
Im looking to restrict what a registered user can see. I have a User Group and I only want that user group to see a certain field within the details.html template.

I've had success with {if user_loggedout}{endif user_loggedout}{if user_loggedin}{endif user_loggedin}
but is there an {if} for permissions / user groups?


Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Permissions Mask?
« Reply #1 on: May 11, 2007, 09:41:52 AM »
...
but is there an {if} for permissions / user groups?

Hi sigma ...
... i think there is not a code / tag in standard 4images for this "if" ...  :roll:
... in "normal" if-tags works one variable ... e.g. ... {if user_loggedout} -> "user_id" ...
... and in this new if-tag must work two variables ... "user_id" and "group_id" ...
... and for permissions we have check_permission("auth_viewcat", $cat_id)  , check_permission("auth_viewimage", $cat_id) a.s.o. ...
... but you want a global "auth_view" ... right ... ?
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Permissions Mask?
« Reply #2 on: May 11, 2007, 06:01:25 PM »
Hi mawenzi, thanks for responding.

I think a global auth_view is the only way. Heres what Im trying to do..
I want to restrict what each usergroup can do with certain images.

if user is group_id 1 - they can download a llimited number of images
if user is group_id 2 - they can download the same images as group_id 1 plus many more

of course this is not possible with the current permission setup unless i move the images into their own category. which is not what I want to do.

do you think this is possible?

Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Permissions Mask?
« Reply #3 on: May 12, 2007, 01:02:08 AM »
what about here:
Code: [Select]
$site_template->register_vars(array(
  "is_in_group_photographer" => (isset($usergroups[USERGROUP_ID])) ? 1 : 0
));

from http://www.4homepages.de/forum/index.php?topic=6566.msg29808#msg29808

add more conditions, like this:

Code: [Select]
$site_template->register_vars(array(
  "is_in_group_photographer" => (isset($usergroups[USERGROUP_ID]) && (your restrinction)) ? 1 : 0
));

I'm beginner but is an idea, I don't know what conditions you need... but you can use sql secuences and add to an array and create your restrinctions.  and you have in page_header $user_info['<<atribute_name>>']
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline sigma.

  • Full Member
  • ***
  • Posts: 148
  • cydonian.com/potd
    • View Profile
    • sigma's gallery
Re: Permissions Mask?
« Reply #4 on: May 12, 2007, 08:17:58 PM »
Thank you, this is usefull but after testing it and thinking about it more i think I really need a option for each image (ACP) the ability to assign what USERGROUP can Download that image. Or maybe what USER can download it.

If there was a dropdown menu for each image that allows you to add permissions ( Usergroups Allowed to Download ) that way would be allot better.

Any ideas? is it possible?


Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: Permissions Mask?
« Reply #5 on: May 12, 2007, 10:01:56 PM »
In my gallery i restrict some fields depended from cat_id in details.html, i think that you could do the same with img_id. But It would be too work  if you have a lot of images. I'm not php programmer, but I think that you want is possible in admin like categories permissions. But sorry i don't know and i don't have time
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more