Skip to content

[#440] Delete deprecated symbols incorporating "UserGroup" as substring #745

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 0 additions & 4 deletions irods/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ class GroupDoesNotExist(DoesNotExist):
pass


# NOTE: Everything of the form *UserGroup* is deprecated.
UserGroupDoesNotExist = GroupDoesNotExist


class ResourceDoesNotExist(DoesNotExist):
pass

Expand Down
2 changes: 2 additions & 0 deletions irods/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def __init__(self, *args, **kwargs):
print("Aborting tests [ Got : %r ]" % self, file=sys.stderr)
os.abort()


class iRODS_Server_Too_Recent_For_Testing(StopTestsException):
pass

Expand All @@ -35,6 +36,7 @@ def _get_server_version_for_test(session, curtail_length):

# Create a connection for test, based on ~/.irods environment by default.


def make_session(test_server_version=False, **kwargs):
"""Connect to an iRODS server as determined by any client environment
file present at a standard location, and by any keyword arguments given.
Expand Down
36 changes: 8 additions & 28 deletions irods/manager/user_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,16 @@ def _api_info(self, group_admin_flag):
def create(
self,
name,
user_type="rodsgroup",
user_zone="",
auth_str="",
group_admin=False,
group_admin=None,
**options,
):
user_zone = options.pop("user_zone", "")
auth_str = options.pop("auth_str", "")
user_type = options.pop("user_type", "rodsgroup")

if not options.pop("suppress_deprecation_warning", False):
if user_zone != "" or auth_str != "" or user_type != "rodsgroup":
warnings.warn(
"Use of session.user_groups is deprecated in v1.1.7 - prefer session.groups",
"Use of non-default value for auth_str, user_type or user_zone in GroupManager.create is deprecated",
DeprecationWarning,
stacklevel=2,
)
Expand All @@ -325,16 +325,8 @@ def getmembers(self, name):
return [iRODSUser(self, row) for row in results]

def addmember(
self, group_name, user_name, user_zone="", group_admin=False, **options
self, group_name, user_name, user_zone="", group_admin=None, **options
):

if not options.pop("suppress_deprecation_warning", False):
warnings.warn(
"Use of session.user_groups is deprecated in v1.1.7 - prefer session.groups",
DeprecationWarning,
stacklevel=2,
)

(MessageClass, api_key) = self._api_info(group_admin)

message_body = MessageClass(
Expand All @@ -349,16 +341,8 @@ def addmember(
logger.debug(response.int_info)

def removemember(
self, group_name, user_name, user_zone="", group_admin=False, **options
self, group_name, user_name, user_zone="", group_admin=None, **options
):

if not options.pop("suppress_deprecation_warning", False):
warnings.warn(
"Use of session.user_groups is deprecated in v1.1.7 - prefer session.groups",
DeprecationWarning,
stacklevel=2,
)

(MessageClass, api_key) = self._api_info(group_admin)

message_body = MessageClass(
Expand Down Expand Up @@ -386,7 +370,3 @@ def set_quota(self, group_name, amount, resource="total"):
conn.send(request)
response = conn.recv()
logger.debug(response.int_info)


# NOTE: Everything of the form *UserGroup* is deprecated.
UserGroupManager = GroupManager
4 changes: 0 additions & 4 deletions irods/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ class Group(Model):
name = Column(String, "USER_GROUP_NAME", 901)


# The UserGroup model-class is now renamed Group, but we'll keep the deprecated name around for now.
UserGroup = Group


class Resource(Model):
id = Column(Integer, "R_RESC_ID", 301)
name = Column(String, "R_RESC_NAME", 302)
Expand Down
50 changes: 1 addition & 49 deletions irods/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,54 +106,6 @@ def available_permissions(self):
)
return self.__access

@property
def groups(self):
class _GroupManager(self.user_groups.__class__):

def create(
self, name, group_admin=None
): # NB new default (see user_groups manager and i/f, with False as default)

user_type = "rodsgroup" # These are no longer parameters in the new interface, as they have no reason to vary.
user_zone = "" # Groups (1) are always of type 'rodsgroup', (2) always belong to the local zone, and
auth_str = "" # (3) do not authenticate.

return super(_GroupManager, self).create(
name,
user_type,
user_zone,
auth_str,
group_admin,
suppress_deprecation_warning=True,
)

def addmember(self, group_name, user_name, user_zone="", group_admin=None):

return super(_GroupManager, self).addmember(
group_name,
user_name,
user_zone,
group_admin,
suppress_deprecation_warning=True,
)

def removemember(
self, group_name, user_name, user_zone="", group_admin=None
):

return super(_GroupManager, self).removemember(
group_name,
user_name,
user_zone,
group_admin,
suppress_deprecation_warning=True,
)

_groups = getattr(self, "_groups", None)
if not _groups:
_groups = self._groups = _GroupManager(self.user_groups.sess)
return self._groups

def __init__(self, configure=True, auto_cleanup=True, **kwargs):
self.pool = None
self.numThreads = 0
Expand All @@ -173,7 +125,7 @@ def __init__(self, configure=True, auto_cleanup=True, **kwargs):
self.metadata = MetadataManager(self)
self.acls = AccessManager(self)
self.users = UserManager(self)
self.user_groups = GroupManager(self)
self.groups = GroupManager(self)
self.resources = ResourceManager(self)
self.zones = ZoneManager(self)
self._auto_cleanup = auto_cleanup
Expand Down