Ejemplo n.º 1
0
def sys_org_info(request, org_id):
    org_id = int(org_id)
    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)

    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)

    return render_to_response('sysadmin/sys_org_info.html', {
        'org': org,
        'users': users,
        'users_count': users_count,
        'total_quota': total_quota,
        'quota_usage': quota_usage,
        'groups': groups,
        'groups_count': groups_count,
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 2
0
def sys_get_org_base_info(org_id):

    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    # users
    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)

    return {
        "org": org,
        "users": users,
        "users_count": users_count,
        "groups": groups,
        "groups_count": groups_count,
        "total_quota": total_quota,
        "quota_usage": quota_usage,
    }
Ejemplo n.º 3
0
def sys_get_org_base_info(org_id):

    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    # users
    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)

    return {
            "org": org,
            "users": users,
            "users_count": users_count,
            "groups": groups,
            "groups_count": groups_count,
            "total_quota": total_quota,
            "quota_usage": quota_usage,
           }
Ejemplo n.º 4
0
 def create_org_group(self, **kwargs):
     group_name = kwargs['group_name']
     username = kwargs['username']
     org_group_id = ccnet_threaded_rpc.create_org_group(self.org.org_id ,group_name, username)
     org_groups = ccnet_threaded_rpc.get_org_groups(self.org.org_id, -1, -1)
     res_group = None
     for group in org_groups:
         if group.id == org_group_id:
             res_group = group
     return res_group
Ejemplo n.º 5
0
 def create_org_group(self, **kwargs):
     group_name = kwargs['group_name']
     username = kwargs['username']
     org_group_id = ccnet_threaded_rpc.create_org_group(self.org.org_id, group_name, username)
     org_groups = ccnet_threaded_rpc.get_org_groups(self.org.org_id, -1, -1)
     res_group = None
     for group in org_groups:
         if group.id == org_group_id:
             res_group = group
     return res_group
Ejemplo n.º 6
0
def sys_org_info(request, org_id):

    org_id = int(org_id)
    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)

    last_logins = UserLastLogin.objects.filter(
        username__in=[x.email for x in users])
    for user in users:
        if user.id == request.user.id:
            user.is_self = True
        try:
            user.self_usage =seafserv_threaded_rpc. \
                    get_org_user_quota_usage(org_id, user.email)
            user.share_usage = 0  #seafile_api.get_user_share_usage(user.email)
            user.quota = seafserv_threaded_rpc. \
                    get_org_user_quota(org_id, user.email)
        except SearpcError as e:
            logger.error(e)
            user.self_usage = -1
            user.share_usage = -1
            user.quota = -1

        # populate user last login time
        user.last_login = None
        for last_login in last_logins:
            if last_login.username == user.email:
                user.last_login = last_login.last_login

    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)

    return render_to_response('sysadmin/sys_org_info.html', {
        'org': org,
        'users': users,
        'users_count': users_count,
        'total_quota': total_quota,
        'quota_usage': quota_usage,
        'groups': groups,
        'groups_count': groups_count,
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 7
0
def sys_org_info(request, org_id):

    org_id = int(org_id)
    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)

    last_logins = UserLastLogin.objects.filter(username__in=[x.email for x in users])
    for user in users:
        if user.id == request.user.id:
            user.is_self = True
        try:
            user.self_usage =seafserv_threaded_rpc. \
                    get_org_user_quota_usage(org_id, user.email)
            user.share_usage = 0 #seafile_api.get_user_share_usage(user.email)
            user.quota = seafserv_threaded_rpc. \
                    get_org_user_quota(org_id, user.email)
        except SearpcError as e:
            logger.error(e)
            user.self_usage = -1
            user.share_usage = -1
            user.quota = -1

        # populate user last login time
        user.last_login = None
        for last_login in last_logins:
            if last_login.username == user.email:
                user.last_login = last_login.last_login

    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)

    return render_to_response('sysadmin/sys_org_info.html', {
            'org': org,
            'users': users,
            'users_count': users_count,
            'total_quota': total_quota,
            'quota_usage': quota_usage,
            'groups': groups,
            'groups_count': groups_count,
            }, context_instance=RequestContext(request))
Ejemplo n.º 8
0
def sys_org_info(request, org_id):
    org_id = int(org_id)
    org = ccnet_threaded_rpc.get_org_by_id(org_id)

    users = ccnet_threaded_rpc.get_org_emailusers(org.url_prefix, -1, -1)
    users_count = len(users)

    # quota
    total_quota = seafserv_threaded_rpc.get_org_quota(org_id)
    quota_usage = seafserv_threaded_rpc.get_org_quota_usage(org_id)
    
    # groups
    groups = ccnet_threaded_rpc.get_org_groups(org_id, -1, -1)
    groups_count = len(groups)
    
    return render_to_response('sysadmin/sys_org_info.html', {
            'org': org,
            'users': users,
            'users_count': users_count,
            'total_quota': total_quota,
            'quota_usage': quota_usage,
            'groups': groups,
            'groups_count': groups_count,
            }, context_instance=RequestContext(request))