We've moved discussions to Discord

Team uses and suggestions (data security and hierarchy structure)

I am working on an app which needs a lot of team features, and I would like to use
1. How could I get the current team role ? any helper ?
2. The use of team role is pretty limited (admin, not admin).  I would like to have app_admin, (not to confuse with system admin in user), manager (who can see all record), user who can see his own record (like uber drivers who see their own records but not others)
3. hierarchy structure of Team so that users of headquarter could see all child teams, but child team members could not see their parent team's record.  

Any comments 
Chris Oliver
1. I'll add this, great idea.
2. It's an array so you can add your own roles to the TeamMember model. I don't know what your app is going to need for roles, so I can't prepopulate them for you. Once I can read minds, I'll be able to. 😜
3. You'll need to add an association to Team (or a separate model) so you can have nested teams. If there is no parent_team_id, you know it's the parent. If there is a parent_team_id, you know it's a child.
Chris Oliver
I've added helpers for current_team_member and current_roles so you can easily access the roles for the current user. TeamMember now has active_roles to give you a list of the roles that are enabled for the user.

Docs are updated here: http://jumpstartrails.com/docs/teams
Thanks for your prompt response.  I don't find the helpers in the latest template of JumpStartPro template.  Where could I find them?

Maybe I am not specific enough.  What I want are

1. To find the CurrentTeamMember record by using current_team and current_user.
So that I could check what is the role of the current_user in the current_team. in my case I would like to have team_member.roles = [TeamAdmin, Manager, User]

2. To create a collection the team_members.personal_team by using current_team.
What I want to do is to assign a task to one of team_members using a dropdown box in form.  That mean the path is likely
current_team -> team_members -> users -> teams (users personal_team).

Chris Oliver
The helpers are here: https://gitlab.com/gorails/jumpstart-pro/blob/master/app/helpers/current_helper.rb

1. I just added that method. current_team_member

You define your roles in app/models/team_member.rb as ROLES = [:team_admin, :manager, :user]

2. I don't know what you mean by this. If you have a Task model, you would associate it with a team and a team member.

class Task
  belongs_to :team
  belongs_to :team_member
  has_one :user, through: :team_member
end
Hi Chris,

Regarding to item 2, the situation is like this. Lets say 

Team Alpha has members (A, B, C)
the task T was could be assigned to the team Alpha, (every member could access it).
Now, I want to re-assigned the task T to a member of the team Alpha only, so I need to find all members' personal team for assignment.   

Hope I 
 
Chris Oliver
I would not reassign it to the member's personal team. I would probably make the team_member association optional.

It would always stay as a Task for Team Alpha, and then optionally you can assign it to one of the Team Members from team Alpha. If no Team Member is assigned, everyone can access. If there is a Team Member assigned, only they can access it.
Well, that is one way to do it. 

Notifications
You’re not receiving notifications from this thread.