Author Topic: Tags permissions  (Read 5601 times)

alacecho

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Tags permissions
« on: December 22, 2009, 01:12:35 pm »
Hi all!
Is possible to control tags permissions?
I've watched that all users of same company can see all tags of all workspace, in spite of the dont have permission to see/edit some workspaces.
Why?
Thank you very much!
Alex.

tek12

  • Guest
Re: Tags permissions
« Reply #1 on: December 23, 2009, 05:07:07 pm »
Yeah, I'd second this... I'd like to understand how the tags work a little better myself.

My first impression was that tags should be confined to workspace, but I found this wasn't the case. All tags are visible regardless of where or who creates them.

Is this intended?

alacecho

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Tags permissions
« Reply #2 on: January 23, 2010, 03:52:17 pm »
Hi all again.
A time ago I readed "Working with Tags" in the wiki. I'dont understand why FengOffice is as secure and allow all permissions options, but... is impossible to prevent that everybody can read all workspace's tags?
Now, my users can't write all tags they want, because another users can read them.
Any solutions?
Thanks!
Alex.

Pet

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 638
  • Always mining for solutions!
    • View Profile
    • The Bet!
Re: Tags permissions
« Reply #3 on: January 24, 2010, 10:02:42 pm »
I find it hard to believe that your tags are so secret, some people can't read them.
Support OpenGoo - Sponsor a Feature! | Follow me on Twitter | OG Support Chat | Did you turn debugging on?

alacecho

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Tags permissions
« Reply #4 on: January 25, 2010, 09:19:51 am »
Thanks, Pet.
Usually, we are working with new producs in differents areas of my company, that must be secret.
Alex.

dam-scasi

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Tags permissions
« Reply #5 on: January 25, 2010, 11:18:53 am »
Hi !
I've also find this unpleasent so I've resolved it by modifying the function getTagNames in /application/models/tags/Tags.class.php :

Code: [Select]
function getTagNames($order_by = 'count') {
$pids = logged_user()->getWorkspacesQuery();
$tagConditions = " (`rel_object_manager` <> 'Contacts' AND `rel_object_id` IN
(SELECT `object_id` FROM `" . TABLE_PREFIX . "workspace_objects`
WHERE `object_manager` = `rel_object_manager` AND `workspace_id` IN ($pids)))
OR (`rel_object_manager` = 'Contacts' AND `rel_object_id` IN
(SELECT `contact_id` FROM `" . TABLE_PREFIX . "project_contacts` obj
WHERE `project_id` IN ($pids)))";

$query = '';
switch ($order_by){
case 'name':
$query = 'SELECT DISTINCT `tag` as `name`  FROM '
. self::instance()->getTableName(true)
. ' WHERE' . $tagConditions . ' GROUP BY `tag` ORDER BY  `tag` ';
break ;
case 'count':
$query = 'SELECT DISTINCT `tag` as `name`, count(`tag`) `count` FROM '
. self::instance()->getTableName(true)
. ' WHERE' . $tagConditions
. ' GROUP BY `tag` ORDER BY `count` DESC , `tag`' ;
break ;
default:
throw new Exception('Invalid tag sort criteria');
}
$rows = DB::executeAll($query);
if(!is_array($rows)) return array();
return $rows;
}

I'm not sure it cover all case but it seems to work well.
« Last Edit: February 10, 2010, 07:09:10 am by dam-scasi »

tek12

  • Guest
Re: Tags permissions
« Reply #6 on: January 29, 2010, 07:30:46 pm »
You Sir! Are a gentleman and a scholar!! This worked beautifully, tested it a bit on my server... and it seemed to confine tag permissions by workspace.

I have to admit, my PHP sucks... so I have no idea what the ramifications of this may be... If I come across any I'll post them here.

Thanks again!

alacecho

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: Tags permissions
« Reply #7 on: February 02, 2010, 01:26:53 pm »
Hi, "dam-scasi"
Oh my God!! Is fantastic!!  ;D
Thank you very much! My PHP's knowledge is very poor, so I can't write codes like this. Now, my tags's windows is clearer and private.
Thank you again!
Alex.

Henry

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Re: Tags permissions
« Reply #8 on: February 02, 2010, 01:38:20 pm »
Thanks for the good job.

It is very helpful and works fine.

 ;D ;D

Henry

cabeza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1004
    • View Profile
    • Feng Office
Re: Tags permissions
« Reply #9 on: April 20, 2010, 04:10:54 pm »
We'll review this for 1.8.

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Tags permissions
« Reply #10 on: April 22, 2010, 09:54:54 am »
Marcos, this was already included in 1.7 beta and improved in 1.7 beta2