Class ::xo::role::RelTypeRole

::xo::role::RelTypeRole[i] create ... \
           [ -rel_type (default "") ]

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xo::role::Role[i]
::xotcl::Class create ::xo::role::RelTypeRole \
     -superclass ::xo::role::Role

Methods (to be applied on instances)

  • filtered_member_list (scripted)

    set rel_type ${:rel_type}
    set query [subst {
      select r.object_id_two as user_id from acs_rels r, membership_rels mr
      where r.object_id_one = :group_id
      and   [:rel_type_clause]
      and   r.rel_id = mr.rel_id
      and   mr.member_state = 'approved'
      and   [:except_clause -lhs r.object_id_two $except]
    }]
    set member_list [xo::dc list get_group_members $query]
    #ns_log notice "FILTERED member list $member_list"
    return [lmap p $member_list {list [person::name -person_id $p$p}]
  • filtered_member_p (scripted)

    set rel_type ${:rel_type}
    set query [subst {
      select r.object_id_two as user_id from acs_rels r, membership_rels mr
      where r.object_id_one = :group_id
      and   r.object_id_two = :user_id
      and   [:rel_type_clause]
      and   r.rel_id = mr.rel_id
      and   mr.member_state = 'approved'
    }]
    return [xo::dc 0or1row check_membership $query]
  • get_group_from_package_id (scripted)

    #
    # Designed to work as well without connection. If we have dotlrn
    # installed, return the community group. Otherwise, return the
    # subsite application group.
    #
    if {[info commands ::dotlrn_community::get_community_id] ne ""} {
      set group_id [search::dotlrn::get_community_id -package_id $package_id]
    } else {
      set subsite_node_id [site_node::closest_ancestor_package  -node_id [site_node_object_map::get_node_id -object_id $package_id]  -package_key [subsite::package_keys]  -include_self  -element "node_id"]
      set subsite_id [site_node::get_object_id  -node_id $subsite_node_id]
      set group_id [application_group::group_id_from_package_id -package_id $subsite_id]
    }
    return $group_id
  • get_members (scripted)

    return [:filtered_member_list -group_id $object_id -except $except]
  • get_object_id (scripted)

    return [:get_group_from_package_id [$object package_id]]
  • is_member (scripted)

    set group_id [:get_group_from_package_id $package_id]
    #ns_log notice "IS MEMBER user_id $user_id -package_id $package_id group_id $group_id"
    return [:filtered_member_p -group_id $object_id -user_id $user_id]
  • rel_type (setter)

  • rel_type_clause (scripted)

    if {${:rel_type} ne ""} {
      return {r.rel_type = :rel_type}
    } else {
      return {r.rel_type <> 'composition_rel'}
    }