зеркало из https://github.com/Azure/AzureGraph.git
class-specific do_operation
This commit is contained in:
Родитель
23b34c85ab
Коммит
0dde061ff2
10
R/az_app.r
10
R/az_app.r
|
@ -13,6 +13,7 @@
|
|||
#' - `new(...)`: Initialize a new app object. Do not call this directly; see 'Initialization' below.
|
||||
#' - `delete(confirm=TRUE)`: Delete an app. By default, ask for confirmation first.
|
||||
#' - `update(...)`: Update the app data in Azure Active Directory. For what properties can be updated, consult the REST API documentation link below.
|
||||
#' - `do_operation(...)`: Carry out an arbitrary operation on the app.
|
||||
#' - `sync_fields()`: Synchronise the R object with the app data in Azure Active Directory.
|
||||
#' - `list_group_memberships()`: Return the IDs of all groups this app is a member of.
|
||||
#' - `list_object_memberships()`: Return the IDs of all groups, administrative units and directory roles this app is a member of.
|
||||
|
@ -96,9 +97,8 @@ public=list(
|
|||
))
|
||||
)
|
||||
|
||||
op <- file.path("applications", self$properties$id)
|
||||
self$graph_op(op, body=properties, encode="json", http_verb="PATCH")
|
||||
self$properties <- self$graph_op(op)
|
||||
self$do_operation(body=properties, encode="json", http_verb="PATCH")
|
||||
self$properties <- self$do_operation()
|
||||
self$password <- password
|
||||
password
|
||||
},
|
||||
|
@ -109,7 +109,7 @@ public=list(
|
|||
az_service_principal$new(
|
||||
self$token,
|
||||
self$tenant,
|
||||
self$graph_op("servicePrincipals", body=properties, encode="json", http_verb="POST")
|
||||
call_graph_endpoint(self$token, "servicePrincipals", body=properties, encode="json", http_verb="POST")
|
||||
)
|
||||
},
|
||||
|
||||
|
@ -119,7 +119,7 @@ public=list(
|
|||
az_service_principal$new(
|
||||
self$token,
|
||||
self$tenant,
|
||||
self$graph_op(op)$value[[1]]
|
||||
call_graph_endpoint(self$token, op)$value[[1]]
|
||||
)
|
||||
},
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#' - `new(...)`: Initialize a new group object. Do not call this directly; see 'Initialization' below.
|
||||
#' - `delete(confirm=TRUE)`: Delete a group. By default, ask for confirmation first.
|
||||
#' - `update(...)`: Update the group information in Azure Active Directory.
|
||||
#' - `do_operation(...)`: Carry out an arbitrary operation on the group.
|
||||
#' - `sync_fields()`: Synchronise the R object with the app data in Azure Active Directory.
|
||||
#' - `list_group_memberships()`: Return the IDs of all groups this group is a member of.
|
||||
#' - `list_object_memberships()`: Return the IDs of all groups, administrative units and directory roles this group is a member of.
|
||||
|
@ -54,15 +55,13 @@ public=list(
|
|||
|
||||
list_members=function(type=c("user", "group", "application", "servicePrincipal"))
|
||||
{
|
||||
op <- file.path("groups", self$properties$id, "members")
|
||||
res <- private$get_paged_list(self$graph_op(op))
|
||||
res <- private$get_paged_list(self$do_operation("members"))
|
||||
private$init_list_objects(private$filter_list(res, type))
|
||||
},
|
||||
|
||||
list_owners=function(type=c("user", "group", "application", "servicePrincipal"))
|
||||
{
|
||||
op <- file.path("groups", self$properties$id, "owners")
|
||||
res <- private$get_paged_list(self$graph_op(op))
|
||||
res <- private$get_paged_list(self$do_operation("owners"))
|
||||
private$init_list_objects(private$filter_list(res, type))
|
||||
},
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#' - `new(...)`: Initialize a new directory object. Do not call this directly; see 'Initialization' below.
|
||||
#' - `delete(confirm=TRUE)`: Delete an object. By default, ask for confirmation first.
|
||||
#' - `update(...)`: Update the object information in Azure Active Directory.
|
||||
#' - `do_operation(...)`: Carry out an arbitrary operation on the object.
|
||||
#' - `sync_fields()`: Synchronise the R object with the data in Azure Active Directory.
|
||||
#' - `list_group_memberships()`: Return the IDs of all groups this object is a member of.
|
||||
#' - `list_object_memberships()`: Return the IDs of all groups, administrative units and directory roles this object is a member of.
|
||||
|
@ -47,16 +48,14 @@ public=list(
|
|||
|
||||
update=function(...)
|
||||
{
|
||||
op <- file.path(private$get_endpoint(), self$properties$id)
|
||||
self$graph_op(op, body=list(...), encode="json", http_verb="PATCH")
|
||||
self$properties <- self$graph_op(op)
|
||||
self$do_operation(body=list(...), encode="json", http_verb="PATCH")
|
||||
self$properties <- self$do_operation()
|
||||
self
|
||||
},
|
||||
|
||||
sync_fields=function()
|
||||
{
|
||||
op <- file.path(private$get_endpoint(), self$properties$id)
|
||||
self$properties <- self$graph_op(op)
|
||||
self$properties <- self$do_operation()
|
||||
invisible(self)
|
||||
},
|
||||
|
||||
|
@ -71,15 +70,13 @@ public=list(
|
|||
return(invisible(NULL))
|
||||
}
|
||||
|
||||
op <- file.path(private$get_endpoint(), self$properties$id)
|
||||
self$graph_op(op, http_verb="DELETE")
|
||||
self$do_operation(http_verb="DELETE")
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
list_object_memberships=function()
|
||||
{
|
||||
op <- file.path(private$get_endpoint(), self$properties$id, "getMemberObjects")
|
||||
lst <- self$graph_op(op, body=list(securityEnabledOnly=TRUE),
|
||||
lst <- self$do_operation("getMemberObjects", body=list(securityEnabledOnly=TRUE),
|
||||
encode="json", http_verb="POST")
|
||||
|
||||
unlist(private$get_paged_list(lst))
|
||||
|
@ -87,15 +84,15 @@ public=list(
|
|||
|
||||
list_group_memberships=function()
|
||||
{
|
||||
op <- file.path(private$get_endpoint(), self$properties$id, "getMemberGroups")
|
||||
lst <- self$graph_op(op, body=list(securityEnabledOnly=TRUE),
|
||||
lst <- self$do_operation("getMemberGroups", body=list(securityEnabledOnly=TRUE),
|
||||
encode="json", http_verb="POST")
|
||||
|
||||
unlist(private$get_paged_list(lst))
|
||||
},
|
||||
|
||||
graph_op=function(op="", ...)
|
||||
do_operation=function(op="", ...)
|
||||
{
|
||||
op <- construct_path(private$get_endpoint(), self$properties$id, op)
|
||||
call_graph_endpoint(self$token, op, ...)
|
||||
},
|
||||
|
||||
|
@ -154,6 +151,7 @@ private=list(
|
|||
"group"="groups",
|
||||
"application"="applications",
|
||||
"service principal"="servicePrincipals",
|
||||
"device"="devices",
|
||||
stop("Unknown directory object type"))
|
||||
}
|
||||
))
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#' - `new(...)`: Initialize a new service principal object. Do not call this directly; see 'Initialization' below.
|
||||
#' - `delete(confirm=TRUE)`: Delete a service principal. By default, ask for confirmation first.
|
||||
#' - `update(...)`: Update the service principal information in Azure Active Directory.
|
||||
#' - `do_operation(...)`: Carry out an arbitrary operation on the service principal.
|
||||
#' - `sync_fields()`: Synchronise the R object with the service principal data in Azure Active Directory.
|
||||
#' - `list_group_memberships()`: Return the IDs of all groups this service principal is a member of.
|
||||
#' - `list_object_memberships()`: Return the IDs of all groups, administrative units and directory roles this service principal is a member of.
|
||||
|
|
15
R/az_user.R
15
R/az_user.R
|
@ -12,6 +12,7 @@
|
|||
#' - `new(...)`: Initialize a new user object. Do not call this directly; see 'Initialization' below.
|
||||
#' - `delete(confirm=TRUE)`: Delete a user account. By default, ask for confirmation first.
|
||||
#' - `update(...)`: Update the user information in Azure Active Directory.
|
||||
#' - `do_operation(...)`: Carry out an arbitrary operation on the user account.
|
||||
#' - `sync_fields()`: Synchronise the R object with the app data in Azure Active Directory.
|
||||
#' - `list_group_memberships()`: Return the IDs of all groups this user is a member of.
|
||||
#' - `list_object_memberships()`: Return the IDs of all groups, administrative units and directory roles this user is a member of.
|
||||
|
@ -78,31 +79,27 @@ public=list(
|
|||
)
|
||||
))
|
||||
|
||||
op <- file.path("users", self$properties$id)
|
||||
self$graph_op(op, body=properties, encode="json", http_verb="PATCH")
|
||||
self$properties <- self$graph_op(op)
|
||||
self$do_operation(body=properties, encode="json", http_verb="PATCH")
|
||||
self$properties <- self$do_operation()
|
||||
self$password <- password
|
||||
password
|
||||
},
|
||||
|
||||
list_owned_objects=function(type=c("user", "group", "application", "servicePrincipal"))
|
||||
{
|
||||
op <- file.path("users", self$properties$id, "ownedObjects")
|
||||
res <- private$get_paged_list(self$graph_op(op))
|
||||
res <- private$get_paged_list(self$do_operation("ownedObjects"))
|
||||
private$init_list_objects(private$filter_list(res, type))
|
||||
},
|
||||
|
||||
list_created_objects=function(type=c("user", "group", "application", "servicePrincipal"))
|
||||
{
|
||||
op <- file.path("users", self$properties$id, "createdObjects")
|
||||
res <- private$get_paged_list(self$graph_op(op))
|
||||
res <- private$get_paged_list(self$do_operation("createdObjects"))
|
||||
private$init_list_objects(private$filter_list(res, type))
|
||||
},
|
||||
|
||||
list_direct_memberships=function(id_only=TRUE)
|
||||
{
|
||||
op <- file.path("users", self$properties$id, "memberOf")
|
||||
res <- private$get_paged_list(self$graph_op(op))
|
||||
res <- private$get_paged_list(self$do_operation("memberOf"))
|
||||
|
||||
if(id_only)
|
||||
sapply(res, function(grp) grp$id)
|
||||
|
|
|
@ -28,6 +28,7 @@ Base class representing an AAD app.
|
|||
\item \code{new(...)}: Initialize a new app object. Do not call this directly; see 'Initialization' below.
|
||||
\item \code{delete(confirm=TRUE)}: Delete an app. By default, ask for confirmation first.
|
||||
\item \code{update(...)}: Update the app data in Azure Active Directory. For what properties can be updated, consult the REST API documentation link below.
|
||||
\item \code{do_operation(...)}: Carry out an arbitrary operation on the app.
|
||||
\item \code{sync_fields()}: Synchronise the R object with the app data in Azure Active Directory.
|
||||
\item \code{list_group_memberships()}: Return the IDs of all groups this app is a member of.
|
||||
\item \code{list_object_memberships()}: Return the IDs of all groups, administrative units and directory roles this app is a member of.
|
||||
|
|
|
@ -27,6 +27,7 @@ Base class representing an AAD group.
|
|||
\item \code{new(...)}: Initialize a new group object. Do not call this directly; see 'Initialization' below.
|
||||
\item \code{delete(confirm=TRUE)}: Delete a group. By default, ask for confirmation first.
|
||||
\item \code{update(...)}: Update the group information in Azure Active Directory.
|
||||
\item \code{do_operation(...)}: Carry out an arbitrary operation on the group.
|
||||
\item \code{sync_fields()}: Synchronise the R object with the app data in Azure Active Directory.
|
||||
\item \code{list_group_memberships()}: Return the IDs of all groups this group is a member of.
|
||||
\item \code{list_object_memberships()}: Return the IDs of all groups, administrative units and directory roles this group is a member of.
|
||||
|
|
|
@ -27,6 +27,7 @@ Base class representing a directory object in Microsoft Graph.
|
|||
\item \code{new(...)}: Initialize a new directory object. Do not call this directly; see 'Initialization' below.
|
||||
\item \code{delete(confirm=TRUE)}: Delete an object. By default, ask for confirmation first.
|
||||
\item \code{update(...)}: Update the object information in Azure Active Directory.
|
||||
\item \code{do_operation(...)}: Carry out an arbitrary operation on the object.
|
||||
\item \code{sync_fields()}: Synchronise the R object with the data in Azure Active Directory.
|
||||
\item \code{list_group_memberships()}: Return the IDs of all groups this object is a member of.
|
||||
\item \code{list_object_memberships()}: Return the IDs of all groups, administrative units and directory roles this object is a member of.
|
||||
|
|
|
@ -27,6 +27,7 @@ Base class representing an AAD service principal.
|
|||
\item \code{new(...)}: Initialize a new service principal object. Do not call this directly; see 'Initialization' below.
|
||||
\item \code{delete(confirm=TRUE)}: Delete a service principal. By default, ask for confirmation first.
|
||||
\item \code{update(...)}: Update the service principal information in Azure Active Directory.
|
||||
\item \code{do_operation(...)}: Carry out an arbitrary operation on the service principal.
|
||||
\item \code{sync_fields()}: Synchronise the R object with the service principal data in Azure Active Directory.
|
||||
\item \code{list_group_memberships()}: Return the IDs of all groups this service principal is a member of.
|
||||
\item \code{list_object_memberships()}: Return the IDs of all groups, administrative units and directory roles this service principal is a member of.
|
||||
|
|
|
@ -27,6 +27,7 @@ Base class representing an AAD user account.
|
|||
\item \code{new(...)}: Initialize a new user object. Do not call this directly; see 'Initialization' below.
|
||||
\item \code{delete(confirm=TRUE)}: Delete a user account. By default, ask for confirmation first.
|
||||
\item \code{update(...)}: Update the user information in Azure Active Directory.
|
||||
\item \code{do_operation(...)}: Carry out an arbitrary operation on the user account.
|
||||
\item \code{sync_fields()}: Synchronise the R object with the app data in Azure Active Directory.
|
||||
\item \code{list_group_memberships()}: Return the IDs of all groups this user is a member of.
|
||||
\item \code{list_object_memberships()}: Return the IDs of all groups, administrative units and directory roles this user is a member of.
|
||||
|
|
Загрузка…
Ссылка в новой задаче