summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaikrishna1511@gmail.com <psaikrishna@ubudesk1004.(none)>2011-04-19 18:21:36 +0530
committersaikrishna1511@gmail.com <psaikrishna@ubudesk1004.(none)>2011-04-19 18:21:36 +0530
commitfd604fcd93d2e933e48ea37463a0f4f8697c6a75 (patch)
tree2c16dcacf36b61b6ac6a2f7932c4725483d7566a
parent6bb28b0d44a444f766b5cfb446e07c3407a99aab (diff)
downloadkeystone-fd604fcd93d2e933e48ea37463a0f4f8697c6a75.tar.gz
keystone-fd604fcd93d2e933e48ea37463a0f4f8697c6a75.tar.xz
keystone-fd604fcd93d2e933e48ea37463a0f4f8697c6a75.zip
Management files except for add/delete user from group
-rw-r--r--management/delgroup.py39
-rw-r--r--management/getgroup.py40
-rw-r--r--management/getgroups.py40
-rw-r--r--management/getgroupusers.py42
-rw-r--r--management/getuser.py40
-rw-r--r--management/getusergroups.py42
-rw-r--r--management/getusers.py42
-rw-r--r--management/groupadd.py42
-rw-r--r--management/setuserlock.py49
-rw-r--r--management/setuserpswd.py41
-rw-r--r--management/updategroup.py41
-rw-r--r--management/userupdate.py39
12 files changed, 497 insertions, 0 deletions
diff --git a/management/delgroup.py b/management/delgroup.py
new file mode 100644
index 00000000..df94f846
--- /dev/null
+++ b/management/delgroup.py
@@ -0,0 +1,39 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+
+def main():
+ usage = "usage: %prog group_id"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ group_id = args[0]
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "DELETE FROM groups WHERE group_id='%s'" % group_id)
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getgroup.py b/management/getgroup.py
new file mode 100644
index 00000000..3cea4891
--- /dev/null
+++ b/management/getgroup.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog group_id"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ user_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select * from groups where group_id = '%s' " % (group_id))
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getgroups.py b/management/getgroups.py
new file mode 100644
index 00000000..ae7b1a3d
--- /dev/null
+++ b/management/getgroups.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog "
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 0:
+ parser.error("Incorrect number of arguments")
+ else:
+ #tenant_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select * from groups where tenant_id = ''")
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getgroupusers.py b/management/getgroupusers.py
new file mode 100644
index 00000000..b22683b1
--- /dev/null
+++ b/management/getgroupusers.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog group_id"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ group_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select u.* from users u inner join user-group ug on
+ u.username = ug.user_id where ug.group_id = '%s' " % (group_id)
+ )
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getuser.py b/management/getuser.py
new file mode 100644
index 00000000..159ce688
--- /dev/null
+++ b/management/getuser.py
@@ -0,0 +1,40 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog username"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ user_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select * from users where ut.username = '%s' " % (user_id))
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getusergroups.py b/management/getusergroups.py
new file mode 100644
index 00000000..38e2f980
--- /dev/null
+++ b/management/getusergroups.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog user_id"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ user_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select g.* from groups g inner join user-group ug on
+ g.group_id = ug.group_id where ug.user_id = '%s' " % (user_id)
+ )
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/getusers.py b/management/getusers.py
new file mode 100644
index 00000000..f333d169
--- /dev/null
+++ b/management/getusers.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog tenant_id"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 1:
+ parser.error("Incorrect number of arguments")
+ else:
+ tenant_id = args[0]
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "select u.* from users u inner join user-tenants ut on
+ u.username = ut.user_id where ut.tenant_id = '%s' " % (tenant_id)
+ )
+ con.commit()
+ print cur.fetchall()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/groupadd.py b/management/groupadd.py
new file mode 100644
index 00000000..4ba3edb9
--- /dev/null
+++ b/management/groupadd.py
@@ -0,0 +1,42 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog group_id group_desc"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("Incorrect number of arguments")
+ else:
+ group_id = args[0]
+ group_desc = args[1]
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "INSERT INTO groups ('group_id','group_desc','tenant_id')
+ VALUES ('%s', '%s','')" % (group_id, group_desc)
+ )
+
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/setuserlock.py b/management/setuserlock.py
new file mode 100644
index 00000000..68af9429
--- /dev/null
+++ b/management/setuserlock.py
@@ -0,0 +1,49 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog username enabled"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("Incorrect number of arguments")
+ else:
+ username = args[0]
+ enabled = args[1].capitalize().strip()
+
+ if enabled == 'True' or enabled == '1' :
+ enabled=1
+ elif enabled == 'False' or enabled == '0' :
+ enabled=0
+ else:
+ parser.error("Incorrect arguments value")
+
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "UPDATE users SET enabled = '%d' where username ='%s'"
+ % (enabled,username)
+ )
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/setuserpswd.py b/management/setuserpswd.py
new file mode 100644
index 00000000..62bb9c05
--- /dev/null
+++ b/management/setuserpswd.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog username password"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("Incorrect number of arguments")
+ else:
+ username = args[0]
+ password = args[1]
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "UPDATE users SET password = '%s' where username ='%s'"
+ % (password,username)
+ )
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/updategroup.py b/management/updategroup.py
new file mode 100644
index 00000000..e29387e1
--- /dev/null
+++ b/management/updategroup.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog group_id group_desc"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("Incorrect number of arguments")
+ else:
+ group_id = args[0]
+ group_desc = args[1]
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "update groups set group_desc = '%s' where group_id = '%s')"
+ % (group_desc,group_id)
+ )
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()
diff --git a/management/userupdate.py b/management/userupdate.py
new file mode 100644
index 00000000..099c8900
--- /dev/null
+++ b/management/userupdate.py
@@ -0,0 +1,39 @@
+# Copyright (c) 2010-2011 OpenStack, LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import optparse
+import os
+import sqlite3
+
+def main():
+ usage = "usage: %prog username email"
+ parser = optparse.OptionParser(usage)
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("Incorrect number of arguments")
+ else:
+ username = args[0]
+ email = args[1]
+ dbpath = os.path.abspath(
+ os.path.join(os.path.dirname(__file__),'../db/keystone.db'))
+ con = sqlite3.connect(dbpath)
+ cur = con.cursor()
+ cur.execute(
+ "update users set email = '%s' where username = '%s')" % (email,username))
+ con.commit()
+ con.close()
+
+if __name__ == '__main__':
+ main()