Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test dm #7385

Merged
merged 7 commits into from
Feb 22, 2025
Merged

test dm #7385

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ on:
push:
branches:
- master
- "12.0"
- "dameng"
- "test_dm"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
32 changes: 16 additions & 16 deletions seahub/utils/ccnet_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def get_ccnet_db_name():
return os.environ.get('SEAFILE_MYSQL_DB_CCNET_DB_NAME', '') or 'ccnet_db'
return os.environ.get('SEAFILE_MYSQL_DB_CCNET_DB_NAME', '') or 'SYSDBA'


class CcnetGroup(object):
Expand Down Expand Up @@ -40,9 +40,9 @@ def list_org_departments(self, org_id):
SELECT
g.group_id, group_name, creator_name, timestamp, type, parent_group_id
FROM
`{self.db_name}`.`OrgGroup` o
{self.db_name}.OrgGroup o
LEFT JOIN
`{self.db_name}`.`Group` g
{self.db_name}.Group g
ON o.group_id=g.group_id
WHERE
org_id={org_id} AND parent_group_id<>0;
Expand Down Expand Up @@ -75,12 +75,12 @@ def status(is_active):

def is_role(role):
if role == 'default':
return 'AND (t2.role is null or t2.role = "default") '
return "AND (t2.role is null or t2.role = 'default') "
else:
return f'AND t2.role = "{role}" '
return f"AND t2.role = '{role}' "

def search(q):
return f'AND t1.email LIKE "%{q}%" '
return f"AND t1.email LIKE '%{q}%' "

search_clause = ''
if is_active:
Expand All @@ -93,9 +93,9 @@ def search(q):
count_sql = f"""
SELECT count(1)
FROM
`{self.db_name}`.`EmailUser` t1
{self.db_name}.EmailUser t1
LEFT JOIN
`{self.db_name}`.`UserRole` t2
{self.db_name}.UserRole t2
ON
t1.email = t2.email
WHERE
Expand All @@ -106,9 +106,9 @@ def search(q):
sql = f"""
SELECT t1.id, t1.email, t1.is_staff, t1.is_active, t1.ctime, t2.role, t1.passwd
FROM
`{self.db_name}`.`EmailUser` t1
{self.db_name}.EmailUser t1
LEFT JOIN
`{self.db_name}`.`UserRole` t2
{self.db_name}.UserRole t2
ON
t1.email = t2.email
WHERE
Expand Down Expand Up @@ -152,7 +152,7 @@ def get_group_ids_admins_map(self, group_ids):
sql = f"""
SELECT user_name, group_id
FROM
`{self.db_name}`.`GroupUser`
{self.db_name}.GroupUser
WHERE
group_id IN ({group_ids_str}) AND is_staff = 1
"""
Expand All @@ -168,15 +168,15 @@ def get_group_ids_admins_map(self, group_ids):

def change_groups_into_departments(self, group_id):
sql = f"""
UPDATE `{self.db_name}`.`Group` g
UPDATE {self.db_name}.Group g
SET
g.creator_name = 'system admin',
g.parent_group_id = -1
WHERE
g.group_id = {group_id}
"""
structure_sql = f"""
INSERT INTO `{self.db_name}`.`GroupStructure` (group_id, path)
INSERT INTO {self.db_name}.GroupStructure (group_id, path)
VALUES ('{group_id}', '{group_id}')
"""

Expand All @@ -190,8 +190,8 @@ def get_active_users_by_user_list(self, user_list):
user_list_str = ','.join(["'%s'" % str(user) for user in user_list])
active_users = []
sql = f"""
SELECT `email`
FROM `{self.db_name}`.`EmailUser`
SELECT email
FROM {self.db_name}.EmailUser
WHERE
email IN ({user_list_str}) AND is_active = 1 AND email NOT LIKE '%%@seafile_group'
"""
Expand All @@ -204,7 +204,7 @@ def get_active_users_by_user_list(self, user_list):

def get_org_user_count(self, org_id):
sql = f"""
SELECT COUNT(1) FROM `{self.db_name}`.`OrgUser` WHERE org_id={org_id}
SELECT COUNT(1) FROM {self.db_name}.OrgUser WHERE org_id={org_id}
"""
user_count = 0
with connection.cursor() as cursor:
Expand Down
Loading
Loading